Table of Contents

Important Notes

There are two key parts to XSLT processing:

Selecting Nodes

The basic XSLT element for selecting a node is :

<xsl:template match=pattern>
    Actions to be taken or text to be written out
</xsl:templates>

When the XSLT processor matches a template's pattern, the node or node set becomes the context node / node set. You can also refer to the current node as '.'

By default a template only matches the the current element and attributes, rather than any children.

Applying Logic to Nodes

The basic construct for applying the logic is:

 <xsl:apply-template> 

The apply-templates construct only applies to nodes or child nodes, but not to attributes. This can addressed by using the select construct in the apply-templates construct.

To apply a specific template the full construct becomes:

<xsl:apply-template select="xpath expression">

You can also apply a names template by substituting the final select section with:

<xsl:call-template name="templatename">
</xsl:call-template>

and adding in:

   <xsl:template name="templatename">
   </xsl:template>

You can also specifiy prameters to pass to the called template by using the

<xsl:param>

and

<xsl:with-param>

inside the called template.

Accesing Node Values

In order to get the value of a node the construct is:

 <xsl:value-of select="xpath expression">