Hi,
You can do as follows:
If you want the indents as well, you may have to use a recursive-string
chopping template to count the number of dots in your numbering element. I
don't see this information available in the structure of your xml file.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl
="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="//numbering">
<xsl:value-of select="."/><xsl:text> </xsl:text>
<xsl:apply-templates select="following-sibling::name" mode="list"/>
</xsl:template>
<xsl:template match="name">
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="name" mode="list">
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
Cheers,
Omprakash.V
Sven Waibel
<sven.waibel@ To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
imbus.de> cc: (bcc: omprakash.v/Polaris)
Subject: [xsl] Recursive?
03/17/2005
02:26 PM
Please
respond to
xsl-list
Hi everybody,
my xml:
<?xml version="1.0" encoding="ISO-8859-15"?>
<it>
<tt id="20">
<numbering>1</numbering>
<name><![CDATA[test0]]></name>
<tc id="4611686020000000015">
<numbering>1.1</numbering>
<name><![CDATA[test1]]></name>
</tc>
</tt>
<tt id="21">
<numbering>2</numbering>
<name><![CDATA[test2]]></name>
<tt id="22">
<numbering>2.1</numbering>
<name><![CDATA[test3]]></name>
<tt id="23">
<numbering>2.1.1</numbering>
<name><![CDATA[tgf]]></name>
<tc id="4611686020000000012">
<numbering>2.1.1.1</numbering>
<name>
<![CDATA[test4]]></name>
</tc>
<tc id="4611686020000000013">
<numbering>2.1.1.2</numbering>
<name>
<![CDATA[test5]]></name>
</tc>
</tt>
<tc id="4611686020000000014">
<numbering>2.1.2</numbering>
<name><![CDATA[test6]]></name>
</tc>
</tt>
</tt>
</it>
I want to get this:
number name
1 test0
1.1 test1
2 test2
2.1 test3
2.1.1 test4
2.1.1.1 test5
2.1.1.2 test6
2.1.2 test7
Should i do it recursively or is there a better way to achieve it?
Thanks and best regards.
Sven
2.
--~------------------------------------------------------------------
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>
--~--
This e-Mail may contain proprietary and confidential information and is sent
for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction,
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its
attachment other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
--~------------------------------------------------------------------
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>
--~--