[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
See Comments interspersed below as to why you get the results you do.
Cheers...Hugh
----- Original Message ----- From: "Fraser Goffin" <goffinf@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, August 05, 2006 7:21 AM
Subject: [xsl] Selecting the first node set
This returns any node named Value that is a descendent of Trade ( there are three node sets)
For this one - where there are three node sets - it returns the first of each set
For this one - where there are three node sets - it returns the second of each set - there are none.
Re: [xsl] Selecting the first node set
Subject: Re: [xsl] Selecting the first node set From: "CyberSpace Industries 2000 Inc." <csi2000@xxxxxxxxxxxxxxx> Date: Sat, 5 Aug 2006 08:08:44 -0400 |
See Comments interspersed below as to why you get the results you do.
Cheers...Hugh
CyberSpace Industries 2000 Inc. XML Training and Consulting
----- Original Message ----- From: "Fraser Goffin" <goffinf@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, August 05, 2006 7:21 AM
Subject: [xsl] Selecting the first node set
Given the following simplified XML instance, can anyone suggest an expression that will return ONLY the 'Value' node containing <enum> children with values A, B and C. I can't rely on the name of the parent node of <Value> hence I have deliberately named these as UnknownNameX or any other intervening structure.
<Trade> <UnknownName1> <Value> <enum>A</enum> <enum>B</enum> <enum>C</enum> </Value> </UnknownName1> <UnknownName2> <Value>/Trade//Value[ancestor::Trade]</Value> </UnknownName2> <Treatment> <UnknownName3> <Value> <enum>D</enum> <enum>E</enum> <enum>F</enum> </Value> </UnknownName3> </Treatment> </Trade>
/Trade//Value - returns all 3 <Value> nodes
This returns any node named Value that is a descendent of Trade ( there are three node sets)
/Trade//Value[1] - also returns all 3 <Value> nodes (why is that ?)
For this one - where there are three node sets - it returns the first of each set
/Trade//Value[2] - returns nothing (why is that ?)
For this one - where there are three node sets - it returns the second of each set - there are none.
Cheers
Fraser.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Selecting the first node set, Fraser Goffin | Thread | Re: [xsl] Selecting the first node , Abel Online |
RE: [xsl] Selecting the first node , cknell | Date | Re: [xsl] Selecting the first node , Abel Online |
Month |
Keywords