[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xslt key used with a predicate of an xpath express

Subject: RE: xslt key used with a predicate of an xpath expression
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 26 Mar 2006 15:08:41 +0100
xslt predicate
Yes, using current() would solve the first problem but not the second.

For the second problem, in XSLT 2.0 you can supply a third argument to key()
to indicate the document (or subtree) to be searched. In 1.0 you have to
change the context node by doing something like

<xsl:for-each select="$otherdoc">
  <xsl:value-of sleect="key(....)"/>
</xsl:for-each> 

> -----Original Message-----
> From: Tim Lebo [mailto:timleboxslt@xxxxxxxxx] 
> Sent: 25 March 2006 17:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  xslt key used with a predicate of an xpath 
> expression
> 
> > "idref" is a relative path expression that means 
> child::idref. The context
> > node is a <color> element, so it looks for a child of the 
> color element
> > named idref, but there is none.
> 
> Would prepending 'current()' in front of 'idref' change the context
> node from $colors/color back to the 'thing' node that it is
> processing? I tried:
> 
>   <xsl:value-of select="concat('The @hex of that object means color ',
>                                
> $colors/color[@hex=key('objects',current()/idref)/@hex],
>                                 ' (.)',$NL)"/>
> 
> To no avail. Probably because it doesn't address the second problem
> you outline, but I'm not sure how to address that.
> 
> 
> > Moreover, the key function searches the document containing 
> the context
> > node. But the color element is in a different document from 
> the one you want
> > to search.
> 
> So the key is searching the the xsl document, while I want it to
> search the input document? Is there a way to get it to search the
> input document by using the $doc(key('objects',current()/idref) or
> key('objects',current()/idref,$doc) constructs?
> 
> Thank you for your patience,
> 
> -Tim Lebo

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.