Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client-side XSLT

Tags:

I converted my whole site to XML/XSL and I would like to know all of the current issues with performing Client-side XSLT.

Here are the ones i already know of (from first-hand experience):

  • Cross-domain XSL files (this is a security issue and not cross browser)
  • disable-output-escaping (this does not work in FF... they consider it a security issue)

Also as for browser support this is all i know of:

  • Opera 9+
  • FF 1.0+
  • SF 2.0 + (i may be wrong on this)
  • Chrome
  • IE 6.0 +

Any others would be helpful too :)

Edit:

As for the 2nd pitfall there is a decent workaround that lets you pass xhtml to your xsl. It works by actually converting and making sure your XHTML is valid XML and placing it into your XML as XML. Then in your XSL you copy the xml ;) and output it as XHTML.

like image 869
Chad Scira Avatar asked May 08 '09 18:05

Chad Scira


People also ask

Is XSLT still a thing?

As of August 2022, the most recent stable version of the language is XSLT 3.0, which achieved Recommendation status in June 2017. XSLT 3.0 implementations support Java, . NET, C/C++, Python, PHP and NodeJS. An XSLT 3.0 Javascript library can also be hosted within the Web Browser.

What is the difference between XSL and XSLT?

XSLT is designed to be used as part of XSL. In addition to XSLT, XSL includes an XML vocabulary for specifying formatting. XSL specifies the styling of an XML document by using XSLT to describe how the document is transformed into another XML document that uses the formatting vocabulary.

How do I run an XML file in XSLT?

If you pick "Show XSLT output" from the "XML" menu, VS will apply the specified transform to the XML file, write its output to the file you specified, and then open that file. If the file has an . xml extension, it'll open it in a text editor window; if it has an . htm extension, it'll open it in a browser window.


2 Answers

  • Speed: The browser needs to apply the XSLT transformation before rendering the HTML, thus the user will have to wait longer to see the page. The XSLT engines used by the browsers might not be top-notch. On Mac OS X, the browser might freeze while the XML is transformed and cause the "spinning beach ball" cursor, thus the user might punch the screen and injure him or herself.

  • Accessibility: What about the browsers not in that set, such as screen-readers? Do those users matter to you?

like image 58
a paid nerd Avatar answered Oct 10 '22 23:10

a paid nerd


On the performance front... consider that the majority of clients these days have 2 CPU's and 2 GB of RAM each, and that most servers don't... Have two CPU's + 2 GB per client that is. So it's certainly logical that offloading the XSLT transforms should improve scalability, and caching CSS + XSLT + JS should reduce overall traffic.

Having said that I've tried using XSLT to produce XHTML containing SVG in the past, and had an epic-fail. The largest page was simply too big (3,000+ entries in an index), and IE uses a DOM to do the XSLT transform, which causes it to start trashing. The same transforms done in xerces-j (on the server, on the same dev box) was about 1000 times faster.

It's high-time the browser-monkeys got with the program ;-)

An interesting discussion. Thanks for raising it.

Cheers. Keith.

like image 36
corlettk Avatar answered Oct 10 '22 21:10

corlettk