Subject: [xsl] FW: Recursion over a tree From: "geoffb" <geoffb@xxxxxxxxxxxxx> Date: Wed, 10 Apr 2002 16:17:55 -0400 |
Hi, I've been messing around in the magical world of XSL recently, and I'm a bit new, so bear with me. One thing I need to do is loop over a structure, which can contain any number of nodes, and any number of levels. The names of the nodes can be different (very important), so my script needs to be modular. Take the following structure (purely an example): <object> <object> <object></object> </object> <object> <object> <object></object> </object> </object> </object> I need to create a tree type structure based on the above structure: object object object object object So... how? I've got the following code, which is meant to be recursive. It is a bit hack... I'm missing something here. <xsl:template match="\"> <xsl:call-template name="recursive-child"> <xsl:with-param name="thisPath" select="following-sibling::*"/> </xsl:call-template> </xsl:template> <xsl:template name="recursive-child"> <xsl:for-each select="thisPath"> <div align="" style="padding-left: 10px;"> <!-- iterate over children --> <xsl:value-of select="name ()"/> </div> <xsl:call-template name="recursive- child"> <xsl:with-param name="thisPath" select="following-sibling::*"/> </xsl:call-template> </xsl:for-each> </xsl:template> Anyway. Any help would be appreaciated! Geoff B XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Seperating a delimited St, Dimitre Novatchev | Thread | Re: [xsl] FW: Recursion over a tree, Joerg Heinicke |
Re: [xsl] combine xml files, Ming | Date | Re: [xsl] FW: Recursion over a tree, Joerg Heinicke |
Month |