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="">
<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>

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.

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Weeks of coding can save you hours of planning.”