[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: retrieve elements with same attribute values
Hi Charles,
Something like below would do it. That defines a key that matches all the items with the same author. Then iterates the authors and if there are more than 2 items matched then outputs them. <?xml version='1.0'?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" indent="no"/> <xsl:key name="itemsByAuthor" match="item" use="author"/> <xsl:template match="/"> <xsl:for-each select="//author[not(.=preceding::author)]"> <xsl:if test="count(key('itemsByAuthor', .))>2"> <xsl:for-each select="key('itemsByAuthor', .)"> <xsl:value-of select="../@name"/> <xsl:text> : </xsl:text> <xsl:value-of select="normalize-space(.)"/> <xsl:text> : </xsl:text> <xsl:value-of select="@name"/> <xsl:text> </xsl:text> </xsl:for-each> </xsl:if> </xsl:for-each> </xsl:template> </xsl:transform> Regards, George --------------------------------------------------------------------- George Cristian Bina - http://aboutxml.blogspot.com/ <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Charles Ohana wrote: Hello friends,
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|