This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: document() and keys

[Get raw message]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]