This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Recursing on top-level elements
<xsl:when test="/test/foo/@id=@id">
is the test you wanted, but
Example XML:
<test>
<foo id=1/>
<foo id=3/>
<bar>
<baz id=1/>
<baz id=2/>
<baz id=3/>
<baz id=4/>
</bar>
</test>
There should of course be quotes around the attribute values: id="1" etc
otherwise it isn't well formed XML.
I would also change the name of the attribute from id.
attributes called id are normally reserved for attributes that are
declared to be of type ID in a DTD (ie the attributes that work with the
XSL id() function). If you used the above with such a DTD then you would
get parse errors because XML ids have to use valid XML names (ie they
can not start with a number. And the same id can not appear on more than
one element you can not have foo and baz both with id 1.
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list