Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
The Internet

W3C Recommends XSL 19

An Anonymous Coward writes: "The W3C upgraded XSL 1.0 to the status of a recomendation today, as they reported in a press release." From that release: "XSLT 1.0 makes it possible to significantly change the original structure of an XML document (automatic generation of tables of contents, cross-references, indexes, etc.), while XSL 1.0 makes complex document formatting possible through the use of formatting objects and properties."
This discussion has been archived. No new comments can be posted.

W3C Recommends XSL

Comments Filter:
  • AC = Not Karmawhore (Score:3, Informative)

    by Anonymous Coward on Tuesday October 16, 2001 @10:35PM (#2439539)
    For those wondering,

    XSL has two parts, XSL:FO and XSLT. XSL:FO is an XML format for the printed page. XSLT is a language for transforming one XML format into another.

    XSLT is an incredibly useful language to learn. Imagine being able to take a Docbook [docbook.org] file and spit out XHTML or XSL:FO > PDF, or... yes, even plain text.

    For an idea of how easy it is I wrote a Docbook to HTML converter for 100 docbook tags in four hours, and I hadn't touched XSLT before.

    XSLT is based around rewriting a data tree. You can step around the tree like a file system. In a hardcoded way like //html/body/h1, or relatively like ../body.

    The language has loops and built in functions for analysing the tree. For example, how many times does a paragraph (p) occur in this HTML document when it's parent is a table cell (td)? count(td/p)

    The downside is the bloated syntax. You know those horror stories about an XML programming language that looked like <xml:if(blah= blah)> do this </xml:if> ? XSL is that. But if you can get past that you'll find one of the most wonderful things for mangling XML into whatever format you want.

  • by cmowire ( 254489 ) on Wednesday October 17, 2001 @02:42PM (#2442438) Homepage
    Actually, there is some great usages for XSLT and XSL.

    The thing that people are forgetting is that XSLT has been a W3C Rec for a long while. They are just recomending XSL now.

    XSLT has many uses that just the DOM doesn't have. With XSLT, you can specify a smaller number of canned transforms to take a completely abstract set of XML tags to a viewable form in your browser.

    An example of this would be an XML document to describe a program:
    <PROGRAM>
    <NAME>Blah</NAME>
    <PLATFORM>Linux 3.0</PLATFORM>
    <DESCRIPTION>This program sucks</DESCRIPTION>
    </PROGRAM>

    Now, tell me, what would a CSS style sheet to properly render this data look like? Sure, you can make the NAME, PLATFORM, and DESCRIPTION tags paragraph level and make them different colors, but that's not helping. With XSLT tree transforms, you can provide a relitively simple scheme for rendering things more like:
    Name: Blah
    Platform: Linux 3.0
    Description: This program sucks

    Now, you CAN do that in DOM, but then you will have to provide source code, most likely in JavaScript, to transform the tree. And then the users who surf with JavaScript turned off because all of the OTHER things it can do, like pop up windows at annoying moments, etc. XSLT just transforms XML documents, nothing more. Once we have good support for XSLT in web browsers, I suspect it will become a very useful tool.

    Now, as for XSL, that's probably a good thing. Sure, there'll be a delay before people actually can handle the formatting objects. But XSL has a more complete formatting model that's useful for more than just webpages. I'm less familiar with it. I suspect they could have added similar functionality to CSS, but this way, your entire formatting process is usable just through transforming an XML tree. This way, you don't need to write all of the CSS parsing code, you just use your DOM. This also means you can embed XSL/XSLT code in a single XML file without any of that messy CDATA stuff.

    Of course, I think that you could also say that making a whole formatting system around XML parsers is about as useful as making a whole OS around OOP messaging syntax. But the biggest generator of XSL code will probably be future word processors converting the style sheets to XML/XSL code.

Software production is assumed to be a line function, but it is run like a staff function. -- Paul Licker

Working...