xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Koes, Derrick" <Derrick.K...@smith-nephew.com>
Subject RE: xsl processing question
Date Tue, 01 Oct 2002 12:48:05 GMT
I have found a very simple solution.

It does not get the difference in the two "lists" of Users, however, since I
know that the first will always be a subset of the second I can use a key.

 

<xsl:key name="users" match="/List/Report/User" use="@userId"/>

 

...

 

<xsl:for-each select="/List/List/User">

  <xsl:if test="not(key('users', @userId))">

    <xsl:apply-templates select="."/>

  </xsl:if>

</xsl:for-each>

 

 

 

-----Original Message-----
From: Koes, Derrick [mailto:Derrick.Koes@smith-nephew.com] 
Sent: Monday, September 30, 2002 1:43 PM
To: 'xalan-j-users@xml.apache.org'
Subject: xsl processing question

 

This isn't specific to Xalan.

 

I need to know how to get a "difference" node set given two sets of like
nodes in the same document.

 

In other words if I have /List/Report/User and /List/List/User as paths to
User element nodes in a document where both node sets have a User with
@userId=1, but /List/List/User also has a User with @userId=2.  How do I get
the node set with User/@userId=2?  Of course, I need a solution that will
process much larger node sets.

 

<List>

  <Report>

    <User userId="1"/>

  </Report>

  <List>

    <User userId="1"/>

    <User userId="2"/>

  </List>

</List>

This electronic transmission is strictly confidential to Smith & Nephew and
intended solely for the addressee. It may contain information which is
covered by legal, professional or other privilege. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy or take any action in reliance on this
transmission. If you have received this transmission in error, please notify
the sender as soon as possible and destroy this message.

This electronic transmission is strictly confidential to Smith & Nephew and
intended solely for the addressee.  It may contain information which is
covered by legal, professional or other privilege.  If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy or take any action in reliance on this
transmission.  If you have received this transmission in error, please
notify the sender as soon as possible and destroy this message.

Mime
View raw message