Library sample chapters

Using XML Queries and Transformations

Simplified Syntax

For very simple stylesheets that consist of only one template matching the root, a special simplified syntax is specified. In this simplified syntax, the whole document is the content of the template. The stylesheets that can use this simplified syntax are often doing transformations, mostly consisting of literals defining a template document. Only a few values from the source document are entered in specific locations.

The XML documents defining an article's content could be transformed by this stylesheet:

<HTML xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<BODY>
<H1><xsl:value-of select="/Article/Title"/></H1>
<p><b><xsl:value-of select="/Article/Intro"/></b></p>
<p><xsl:value-of select="/Article/Body"/></p>
</BODY></HTML>

XSLT Language Extensions

XSLT processor vendors are free to add their own private extensions to the language. The XSLT specification even specifies how they should indicate if an extension element or extension function is supported by their implementation.

In the stylesheet, certain namespaces can be specified to be XSLT extension namespaces with the xsl:extension-element-prefixes attribute on the stylesheet element. Elements in those namespaces will be processed using the extensions of the used processor.

If the stylesheet author wants to know if the processor supports a certain extension element, the function element-available() can be called with the element name as the parameter. If the processor supports this element, the function should return true.

Comments

  1. 02 Nov 2004 at 14:03

    The table under "format attribute" on the following page also seems to be truncated:  http://www.developerfusion.com/show/89/10/

  2. 16 Jun 2002 at 12:01

    my apologies for that, it appears the article became truncated. The rest of the text on 'giving style to  XML' is now there.


    Regards,

  3. 16 Jun 2002 at 10:25

    The 'giving style to XML' part of the article (which is the only part that interested me, sigh) is apparently corrupt - It ends in the middle of a sentence, and so it doesn't explain one bit of what it promises to...

  4. 01 Jan 1999 at 00:00

    This thread is for discussions of Using XML Queries and Transformations.

Leave a comment

Sign in or Join us (it's free).

AddThis

We'd love to hear what you think! Submit ideas or give us feedback