Adding custom data to the page

Applying an XML template

In the .xsl file, insert the following line in place of the entire tag that contains the data to be loaded from the XML file. e.g. for NAVIGATE, I removed the <li><a href="" title="">text</a></li> line in order to load customised settings for the href, title and text. Insert:

<xsl:apply-templates select="CODEHELP/NAVIGATE"/>

Make sure you specify the correct selection, replace CODEHELP/NAVIGATE with your main tag and the desired custom tag.

Now you need to create the template to use. At the end of the .xsl file, after the final </xsl:template> line add and customise the following extract from codehelp.xsl to match your requirements:

<xsl:template match="CODEHELP/NAVIGATE"/>
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="FILE"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="DESC"/>
</xsl:attribute>
<xsl:value-of select="CLICK"/>
</a>
</li>

Note: The <a> tag is not left half open at the start (<a ). XML adds the attribute values inside the tag itself by matching the attribute with the value-of the XML data. To insert plain text, outside the tag, omit the xsl:attribute tags, as with the CLICK value.



This is part of www.codehelp.co.uk Copyright © 1998-2004 Neil Williams
See the file about.html for copying conditions.