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

How to: Reference to the current Nodeset while process

Subject: How to: Reference to the current Nodeset while processing through another one
From: news@xxxxxxxxxxx
Date: Wed, 29 Sep 2004 10:41:53 +0200
while process
Hello List,

I'm having the following XML structure:

<XML>
	<Value id="123">
		<aNode>bla</aNode>
	</Value>
	<Value id="123">
		<aNode>bla bla</aNode>
	</Value>
	<Value id="321">
		<aNode>blub</aNode>
	</Value>
</XLM>

How you can see I ve got a pretty flat hierarchy. In this case I ve got
nothing else than 3 Values, each having a child node "aNode". Two of the
"Value" items having a "id" with a value of "123", one having "321". 
This is just a simplification of the mush more complex XML strucure I really
have, so the following question might make no real sence with the XML above.
But it can show what my question is all about, I hope :)

While processing a Nodeset "Vakue" having a attribut "id" with a value of
"123", I want to get all other "Value" items, having the same id. I want to
get them without using a referenc variable.

I tried:
<xsl:for-each select="//Value[@id = Value/@id]">
	<!-- Do something -->
</xsl:for-each>

But this returned all Values having a attribut "id".

If I declare a variable with the value of "id"
<xsl:variable name="v_id">
	<xsl:value-of select="@id"/>
</xsl:variable>

and process though the other nodes by using the variable it works:
<xsl:for-each select="//Value[@id = $v_id]">
	<!-- Do something -->
</xsl:for-each>

In this case I get all "Value" nodes having a "id" of "123".
But how can I do this without using a variable? 
I m builing a processing variable this way, and do'nt want to define other
global variables just for 
building another one.

Thanks a lot!
Jan

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.