Thread: xsl question
View Single Post
  #2 (permalink)  
Old September 14th, 2005, 02:27 AM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

Try to avoid using // in paths, it's an expensive process to select all nodes in the document when you know what level they are at anyway.
Your main problem is that your param defaults to Education, i.e. the XSLT tries to evaluate Education as a node test not a string, you need 'Education'. Your search logic can also be simplified, try this:
<xsl:stylesheet version="1.0" xmlns:xsl="">
  <xsl:param name="LINK" select="'Education'" />

  <xsl:template match="/">   
    <xsl:apply-templates select="HEADER/LINK[@name = $LINK]" />

  <xsl:template match="LINK">
    <h3><xsl:value-of select="@name" /></h3>
    <xsl:apply-templates select="TITLE" />

  <xsl:template match="TITLE">
    <a href="{following-sibling::URL[1]}"><xsl:value-of select="." /></a>  
I think your XML would be easier to manage if you had thius sort of thing:
  <LINKS name="Education">


Joe (Microsoft MVP - XML)
Reply With Quote