|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Extracting Unique element names and attributes fro
> I need to list out all elements and attribute (unique) in a text file > for mapping with other XML file. > > I am able to get all the elements and attributes but I am unable to > achieve the uniqueness. Can any body help on this. > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> If you are stuck with 1.0 then you need to use a key: <xsl:key name="names" match="*|@*" use="name()"/> with <xsl:for-each select="//*|//*/@*"> <xsl:if test="generate-id(.) = generate-id(key('names', name(.))[1])"> <xsl:value-of select="local-name()"/> In 2.0 you can use distinct-values() or xsl:for-each-group, but it always good to learn this technique. -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
|
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
|






