[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Predicate Evaluation
Per Scott's suggestion, I've replaced the variables by current()/ns1:Element2, that looks much better. Thanks. On 11/26/07, Scott Trenda <Scott.Trenda@xxxxxxxx> wrote: > 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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|