Benefits/Disadvantages of using XSL to render enti

2019-03-25 08:36发布

I am in the preliminary stages of planning a project with a client to redo their current website. I took a look at their current site to see what issues they are currently dealing with and upon inspection I noticed that every page is being rendered entirely using XSLT. I am familiar with XSLT, I have used it to render custom controls that need to be refreshed often on the client-side, but never to render an entire page.

Help me become less ignorant, what could be the reasoning behind this? What benefits or disadvantages does this bring to the table?

标签: xslt
7条回答
Summer. ? 凉城
2楼-- · 2019-03-25 09:15

Sounds like they did it because they knew XSL-T very well and already had XML data on hand.

I wouldn't like the solution myself. XSL-T isn't the easiest thing to read or write. It doesn't lend itself well to visualizing how a page will look. It cuts designers and web developers out of the process. And it doesn't internationalize well. There's nothing equivalent to Java resource bundles that can pull out locale specific information. I don't consider cut & paste a good solution.

查看更多
叛逆
3楼-- · 2019-03-25 09:15

XSLT on client side

  • Disables progressive rendering. User won't see anything at all until entire stylesheet and data is loaded completely.
  • Not supported by search engines and other crawlers. They'll see raw XML.
  • Not supported by older/less advanced browsers.

XSLT in general

  • Unless you carefully design your stylesheets, they may quickly become difficult to maintain:
    • with numerous templates it may be very difficult to figure out which templates are applied.
    • verbosity of XSLT and XML syntax make it hard to understand anything at glance.
    • XPath tricks are tempting, but nightmare to modify later.
查看更多
兄弟一词,经得起流年.
4楼-- · 2019-03-25 09:19

Biggest benefit: platform neutral way to render xml

Biggest disadvantage xsl is difficult to maintain

I've once had to work with an xsl over 4,000 lines long that also includes several other xsl templates. Now that was hard to work with!

查看更多
贼婆χ
5楼-- · 2019-03-25 09:21

I think XSLT is great when built the right way(We use a framework of templates at work).

查看更多
smile是对你的礼貌
6楼-- · 2019-03-25 09:27

The answers above provide a good survey of some of the advantages and disadvantages of XSLT. I'd like to add another disadvantage. We have found that you pretty quickly run into scalability issues when using XSLT for moderately large datasets.

When processing XML files, XSLT must load the entire document into memory. With Xalan, this consumes roughly 10x the size of the input file (saxon has an alternative DOM implementation that uses less memory). If any of your input datasets grow beyond a couple of hundred megabytes, your XSLT processor might just flake out.

查看更多
Evening l夕情丶
7楼-- · 2019-03-25 09:28

Sounds like the All-singing-all-dancing XML fetish.

Since you can do anything with XSLT, might as well do everything. I've had people ask why a data warehouse isn't just XSLT transforms between input, data mart and reports.

Advantage. Everything's in XML.

Disadvantages.

  • Not very readable. Your page templates are bound up as XSLT transformations with confusing looping and conditional processing features.

  • Any change to page templates requires an XSLT expert, in addition to the graphic designer who created (and debugged) the HTML and CSS.

查看更多
登录 后发表回答