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]
Other format: [Raw text]

Re: keys vs. parameters


>  From what I understand, there is no
> way of building a key on the external document (results from document()) or
> a nodeset returned from an extension?

If you use xsl:key then (separate) key tables are made for that match in
_every_ document processed (conceptually, the system probably has
optimisations so it doesn't produce tables that are never used).

when you use key('foo','bar') it looks up bar in the foo table
associated with the current document. So you just need to make sure you
are
in the document that you want, so

<xsl:for-each select="document(...) "><!-- or xx:node-set() or ...-->
  <xsl:value-of select="key('foo','bar')"/>
note the for-each here is just iterating over a list of size 1 root
  node, just to move the context document so key does the right thing.

Just to show XPath2 is not entirely an ugly blot on the landscape
I could point out that xpath2 should allow a slightly saner syntax
of
  <xsl:value-of select="document(..)/key('foo','bar')"/>

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 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]