xsl-list
[Top] [All Lists]

[xsl] Stylesheet to output XML Tags (node names)

2006-04-20 04:12:56
I've made this little stylesheet to output XML Tags (node names). Is
it OK, from the point of view of functionality/performance?

I did noticed (or so it seems to me) that changing the select clauses to

*[generat-id(.)=generate-id(key('tags', name())]

will slow down the processing...



<?xml version='1.0' encoding='ISO-8859-1'?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
        <xsl:key name="tags" match="*" use="name()" />
        <xsl:template match="/">
                <nodetags>
                        <xsl:apply-templates select="*[count(. | key('tags', 
name())[1]) = 1]"/>
                </nodetags>
        </xsl:template>
        <xsl:template match="*">
                <tag>
                        <xsl:value-of select="name()" />
                </tag>
                <xsl:apply-templates select="*[count(. | key('tags', 
name())[1]) = 1]"/>
        </xsl:template>
</xsl:transform>

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>