xsl-list
[Top] [All Lists]

Re: [xsl] Using XSLT's key() function while context in secondary document?

2008-02-20 05:10:43
Scott Trenda schrieb:
Alternatively, you could do the same with a little less code:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:key name="chnam" match="Chnl" use="@ID" />
  <xsl:template match="/">
    <Urmel>
      <xsl:for-each select="key('chnam', document('s.xml')//Channel)">
        <p><xsl:value-of select="@ID"/> this works</p>
      </xsl:for-each>
    </Urmel>
  </xsl:template>
</xsl:stylesheet>

Thanks a lot, Scott - this is perfectly suited for my purposes and looks
much better!

I was wondering whether all those context changes were costly operations
but decided it didn't matter enough to bother. Thanks to your help, the
context changes are eliminated and the code is lean and clean.

Michael

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--