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/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--