Thank you David! This is marvellous.. My attempt was -
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:for-each select="//*">
Element name <xsl:value-of select="name()"
/><xsl:text>
</xsl:text>
Ancestor elements of this element
<xsl:text>
</xsl:text>
<xsl:text>
</xsl:text>
<xsl:call-template name="printAncestors">
<xsl:with-param name="node" select="." />
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="printAncestors">
<xsl:param name="node" />
<xsl:choose>
<xsl:when test="$node/parent::*">
<xsl:value-of select="name($node)" />,
<xsl:call-template name="printAncestors">
<xsl:with-param name="node"
select="$node/ancestor::*"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="name($node)" />,
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
But this did'nt work.. ;)
THANK YOU.
Regards,
Mukul
On 8/3/05, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
<xsl:for-each select="//*">
<xsl:text> </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text> - </xsl:text>
<xsl:for-each select="ancestor::*">
<xsl:sort select="-count(ancestor::*)"/>
<xsl:value-of select="name()"/>
<xsl:if tets="position()!=last()">,</xsl:if>
</xsl:for-each>
</xsl:for-each>
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--