Honglin,
This is easily done.... just put an <xsl apply-templates /> tag first
in the <xsl:template/> block.
Here's an example:
xml-
----------------------------------------------
<root>rootnode
<node>one
</node>
<node>five
<node>two
</node>
<node>four
<node>three
</node>
</node>
</node>
</root>
----------------------------------------------
xsl-
---------------------------------------------
<xsl:template match="root">
<xsl:apply-templates select="./*"/>
<xsl:value-of select="./text()"/>
</xsl:template>
<xsl:template match="node">
<xsl:appy-templates select="./*"/>
<xsl:value-of select="./text()"/>
</xsl:template>
----------------------------------------------
output-
--------------------------------------------
one
two
three
four
five
rootnode
---------------------------------------------
Hope this helps,
Charlotte Allen
> Hi, there,
>
> When the XSL processor processes the XML document, it will read the root
> element first, then the child elements. Can we construct an XSL
> stylesheet to do the post-order traverse, it print out the leaf element
> which has no child, then the parents, and the last one is the root
> element.
>
> Thank you!
>
> Honglin
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Traverse order
- Honglin Su - Tue, 17 Aug 1999 16:18:17 -0400
- Charlotte.Allen - Wed, 18 Aug 1999 05:12:40 +0800 (GMT) <=
- <Possible follow-ups>
- Mike Brown - Tue, 17 Aug 1999 15:35:32 -0600
|
|