[thelist] XML/XSL query

Nik Schramm n at industriality.com
Thu Mar 20 07:04:31 CST 2003


On 20.Mar.03 13:47 Brothercake wrote

>> All server side languages now offer XML parsers and 
>> libraries/modules that perform XML-DOM actions for you, 
>> so why should the average server side programmer 
>> switch from his familiar language to XSL?
> 
> How about - because XSL is platform and process independent; you can 
> (for example) build sophisticated data-driven websites using XML and 
> XSL, then move it from (or share its data and processes between) 
> Apache/PHP to IIS/ASP, and only have to change *four lines of code* :)

I agree, but it's not just that (after all how often do you actually 
move sites from one server type to another?).

In my experience wherever a site involves or threatens to involve the 
display and manipulation of large amounts of XML based data, such as on 
a newspaper or other text-heavy site, XSL cannot be beat for flexibility 
or ease of implementation.

It most certainly beats DOM based content manipulation routines 
(firstChild.firstChild.nextSibling.firstChild.nodeValue anyone?).

For example, in Asp.NET a complex data display using XML/XSL can be 
implemented in 1 (ONE!) line of server-side code.

<asp:xml id="myXML" DocumentSource="file.xml" TransformSource="file.xsl" 
runat="server" />

I can also pass variables to the xsl stylesheet from within my page to 
influence the data display.

Last time I checked it wasn't quite as easy as that in other languages, 
but admittedly it's been a while since I worked with anything but .NET, 
so presumably this has been rectified.

Beats me why it's having a hard time catching on, I really like it. 
Perhaps it's because it has a steep-ish learning curve, but boy, is it 
ever worth it.

Incidentally, all it took for me to "get" it and begin using it 
everywhere was purchasing the fabulous Michael Kay's XSLT Programmer's 
Reference by - now sadly defunct - Wrox. Highly recommended.

http://www.amazon.com/exec/obidos/tg/detail/-/1861005067/

-- 
/nik



More information about the thelist mailing list