Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Instances of a node

Status
Not open for further replies.

ashridharan

Technical User
Aug 19, 2001
26
0
0
US
Hi
I have an XML document which looks like
<ROOT>
<PARENT Id=&quot;1&quot;>
<SOMENODE>ABC</SOMENODE>
<SOMENODE>123</SOMENODE>
<SOMENODE>XYZ</SOMENODE>
</PARENT>
<PARENT Id=&quot;2&quot;>
<SOMENODE>123</SOMENODE>
</PARENT>
</ROOT>
As can be seen, there are multiple instances of &quot;SOMENODE&quot;. the condition i want to execute is to return all &quot;PARENT&quot; ids which has no instance of &quot;SOMENODE = 123&quot;

However, the XML parser (MSXML as well as .NET) takes each node as an individual node and does not group them. This returns node 1 in the result set. This is however the wrong result as neither of the PARENT nodes satisfy this clause.

Does anyone have any clues about how to solve this ?

thanks in advance
 
Hi ashridharan,

Try using:
Code:
<xsl:for-each select=&quot;ROOT\PARENT[not(SOMENODE = &quot;123&quot;)]&quot;>
   <xsl:value-of select=&quot;@Id&quot;/>
</xsl:for-each>
Good luck!

Jordi Reineman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top