[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] parameters - element vs attributes


Subject: RE: [xsl] parameters - element vs attributes
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Thu, 3 Jun 2004 16:03:57 +0100

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


Current Thread