|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Flat -> hierarchy.
Appears to be a FAQ ?
> All that I realy neef to know is how I can go about calling The same
> function and moving down to the next node.
>
> <Node>
> A1
> </Node>
> <Node>
> A2
> </Node>
> <Node>
> A3
> </Node>
>
> So I Can Get
>
> <A1><A2><A3></A3></A2></A1>
--------------- flat.xml:
<doc>
<Node>
A1
</Node>
<Node>
A2
</Node>
<Node>
A3
</Node>
</doc>
--------------- hier.xsl
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/doc">
<xsl:call-template name="level">
<xsl:with-param name="node" select="/doc/Node[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="level">
<xsl:param name="node"/>
<xsl:variable name="n" select="normalize-space($node)"/>
<xsl:element name="{$n}">
<xsl:if test="$node/following::Node">
<xsl:call-template name="level">
<xsl:with-param name="node" select="$node/following::Node"/>
</xsl:call-template>
</xsl:if>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
---- result:
<?xml version="1.0" encoding="utf-8"?>
<A1><A2><A3/></A2></A1>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








