是什么阻止了 XSLT 广泛用于网页? [英] What is preventing widespread use of XSLT for webpages?

查看:24
本文介绍了是什么阻止了 XSLT 广泛用于网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么没有更多的网页使用带有 XSLT 样式表的 XML 编写?为了将内容与表示分离,这与 CSS 结合会更加强大.现在,对于输出导航菜单之类的事情,人们经常在页面之间手动复制导航菜单代码或执行诸如

Why aren't more webpages written using XML with an XSLT stylesheet? For separating content from presentation, this combined with CSS would be even more powerful. Right now, for things like outputting a navigation menu, people often hand-copy the navmenu code from page to page or do something like

<?php include_once('myheader.inc'); ?>

在每一页上,这不仅对服务器提出了更多的要求,而且导致重复传输数据.

on every page, which not only puts more demand on the server, but results in duplicated data transmitted.

当我被介绍到它时,我被告知所有主要浏览器回到 IE6 都支持 XSLT 1.0...实现之间是否存在无法解决的错误?是否有其他阻碍或严重缺乏阻碍 XML+XSLT 传播的特性?我最近看到的唯一一个 XML+XSLT 网站是 starcraft2.com.

When I was introduced to it, I was told that all major browsers back to IE6 support XSLT 1.0... are there unresolvable bugs between implementations? Are there others showstoppers or severely lacking features that are inhibiting the spread of XML+XSLT? The only website I've seen lately that is XML+XSLT is starcraft2.com.

推荐答案

  1. 非常冗长
  2. (在复杂系统中)很难追踪模板被调用的方式/地点/原因/时间
  3. 由于输出必须格式正确,因此您不能有一个模板来打开" HEAD 或 BODY 标签,然后您会担心稍后在其他地方关闭.当您希望能够在处理 BODY 中的内容时将代码位排入 HEAD,这很糟糕.
  4. 导航代码不像以下方法调用那样容易
  5. 输出诸如 IE 条件注释之类的内容与所有需要的转义非常混乱
  6. 通过附加位来构建 HTML 字符串是行不通的.这可以通过在 XSL 代码中一点一点地构建 HTML 字符串来克服,但它变得非常复杂.

然而,最重要的是(恕我直言)它为这个过程增加了一个额外的层次,不会买"你太多.

However most of all (IMHO) it adds an extra layer to the process that doesn't "buy" you much.

例如通常您有:

DB > SQL > [JAVA|PHP|ASP|Python|Ruby] > HTML

但是如果您将 XML 和 XSL 放入其中,则您添加了(可能)难以证明的步骤

but if you throw XML and XSL in, you've added steps that (can be) hard to justify

DB > SQL > [JAVA|PHP|ASP|Python|Ruby] > XML > XSL > HTML

以方便的、通用的、可交换的 XML 格式保存数据非常棒,但除非您需要,否则您所做的只是添加步骤.

having the data in a handy dandy universally exchangeable XML format is great-n-all, but unless you need it, all you've done is add steps.

现在我不应该过多地敲 XSL,因为我一直在使用它,并且确实欣赏它提供的一些强大的选项.但是,对于决定是否要使用它的任何人,请在开始使用之前确保您有需求.

Now I shouldn't knock XSL too much because, well I use it all the time and do appreciate some of the powerful options it provides. However to anyone deciding if they want to use it, be sure you have a need before diving in.

这篇关于是什么阻止了 XSLT 广泛用于网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆