xsl-list
[Top] [All Lists]

RE: parameters - element vs attributes

2004-06-03 08:03:57
<xsl:template name="siteLinks">
<xsl:param name="theLinkGroup"></xsl:param>
 <h2><xsl:value-of select="$theLinkGroup" /></h2>           
<!----- does
work
  <ul class="xsmall">
  <xsl:for-each select="//$theLinkGroup/link">                
   <!-----
won't work
   <li><a>
    <xsl:attribute name="href"><xsl:value-of 
select="url"/></xsl:attribute>
     <xsl:value-of select="@title"/>
    </a></li>
  </xsl:for-each>
  </ul>
</xsl:template>

Nearly there, you want:

<xsl:for-each select="//link[parent::*[local-name() = $theLinkGroup]]">

Which roughly translates to 'select all <link> elements which have a
parent element called whatever the $theLinkGroup is, in any namespace'.

cheers
andrew 


<Prev in Thread] Current Thread [Next in Thread>