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

RE: Predicate Evaluation

Subject: RE: Predicate Evaluation
From: "Scott Trenda" <Scott.Trenda@xxxxxxxx>
Date: Mon, 26 Nov 2007 09:14:39 -0600
RE:  Predicate Evaluation
Looking at your input... have you considered using a key? Like so:

<xsl:key name="ns2:Element2" match="ns2:Element2" use="."/>

...

<!-- the result of the key() will be a node-set containing the
ns2:Element2 elements -->
<xsl:for-each select="key('ns2:Element2',
$param1/ns1:Element1/ns1:Element2)">
  <ns3:Element2>
    <xsl:value-of select="."/>
  </ns3:Element2>
</xsl:for-each>

When you feed in a node-set to the second parameter of key(), it returns
a node-set that is equivalent to the result of calling key() on each
node in that node-set. Which would be the same as what you're doing here
- creating a ns3 copy of every node with an equal value between
ns1:Element2 and ns2:Element2.

~ Scott


-----Original Message-----
From: Fernando Ribeiro [mailto:webmaster@xxxxxxxxxxxxxxxxxxxxxx]
Sent: Monday, November 26, 2007 9:06 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Predicate Evaluation

Humm, my mistake. I was trying to select a ns2:Element2 element which
value is equal to the value of a ns1:Element2 element, instead. What
would be the right expression to do so? Thanks.

...

These are the inputs:

<ns1:Element1 xmlns:ns1="urn:ns1">
   <ns1:Element2>Test</ns1:Element2>
 </ns1:Element1>

<ns2:Element1 xmlns:ns2="urn:ns2">
   <ns2:Element2 attribute1="value1">Test</ns2:Element2>
  <ns2:Element3>value1</ns3:Element3>
 </ns2:Element1>

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-2011 All Rights Reserved.