Hello, I have a xml like this: <root> <item name="111"> <subitem name="aaa"> <subitem name="bbb"> </item>.... Now I want to output the item names for some subitems. example: I want all item names with a subitem "aaa" I can do that. Now comes the but: I want them only be outputted once. How can I do that? bye bembi
Index items and then take only first one: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name="item" match="item" use="subitem/@name"/> <xsl:template match="/"> <out> <xsl:value-of select="key('item', 'aaa')[1]/@name"/> </out> </xsl:template> </xsl:stylesheet> -- Oleg bbembi_de@lycos.de wrote: > Hello, > > I have a xml like this: > > <root> > <item name="111"> > <subitem name="aaa"> > <subitem name="bbb"> > </item>.... > > Now I want to output the item names for some subitems. > example: I want all item names with a subitem "aaa" > > I can do that. Now comes the but: > I want them only be outputted once. > > How can I do that? > > bye bembi