[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: pairing up similar tags based on an attribute
Hi,
It is not very clear for me what is your input and what is your output... Anyway, have a look at the following stylesheet, on your example it will output pair(9300033,9300133) with common parent 9310079 pair(9300033,9300133) with common parent 9310023 <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name="specByParent" match="spec" use="@parentpn"/> <xsl:template match="spec[@partnumber=9300033]"> <xsl:variable name="specs" select="key('specByParent', @parentpn)"/> <xsl:text>pair(9300033,</xsl:text> <xsl:value-of select="$specs[generate-id()!=generate-id(current())]/@partnumber"/> <xsl:text>) with common parent </xsl:text> <xsl:value-of select="@parentpn"/> </xsl:template> <xsl:template match="spec"/> </xsl:stylesheet> Hope that helps, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Webmaster wrote: Hello.
|
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
|