RE: [xsl] Predicate Evaluation

Subject: RE: [xsl] Predicate Evaluation
From: "Scott Trenda" <Scott.Trenda@xxxxxxxx>
Date: Mon, 26 Nov 2007 09:14:39 -0600
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',
    <xsl:value-of select="."/>

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: [xsl] 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">

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

Current Thread