Re: [xsl] document() and keys

Subject: Re: [xsl] document() and keys
From: spam-from-xsl-list@xxxxxxxxxxxx
Date: 14 Nov 2001 00:58:20 +0000
Hi Jeni,

    Phil> The problem is that I want to pass the selected node as a
    Phil> parameter to a named template.  I have tried this:
    Phil> 
    Phil> <xsl:call-template.....>
    Phil>   <xsl:for-each select="$src-root">
    Phil>     <xsl:with-param .... select="key(keyname,...)"/>
    Phil>   </xsl:for-each>
    Phil> </xsl:call-template>

    Jeni> Try putting the xsl:for-each around the xsl:call-template:
    Jeni> 
    Jeni> <xsl:for-each select="$src-root">
    Jeni>   <xsl:call-template ...>
    Jeni>     <xsl:with-param ... select="key(keyname, ...)" />
    Jeni>   </xsl:call-template>
    Jeni> </xsl:for-each>

Unfortunately I need the current node to be unchanged over the
call-template.

I guess I could make the current node a parameter:

<xsl:variable name="dot" select="."/>
<xsl:for-each select="$src-root">
  <xsl:call-template....>
    <xsl:with-param name="dot" select="$dot"/>
    <xsl:with-param .... select="key(keyname,...)"/>
  </xsl:call-template>
</xsl:for-each>

<xsl:template name="...">
  <xsl:param name="dot"/>
  <xsl:for-each select="$dot">
    ....
  </xsl:for-each>
</xsl:template>


but I think that's pretty horrible.   Isn't there a better way?

Thanks for your reply.

--Phil.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread