|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Breadth First Traversal
Try something like this: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:call-template name="traverse"> <xsl:with-param name="list" select="a" /> </xsl:call-template> </xsl:template> <xsl:template name="traverse"> <xsl:param name="list" /> <xsl:for-each select="$list"> <!--call "DoSomething" here, comment out the following line--> <xsl:value-of select="@id" /> </xsl:for-each> <!--go to next level--> <xsl:variable name="children" select="$list/a" /> <xsl:if test="$children"> <xsl:call-template name="traverse"> <xsl:with-param name="list" select="$children" /> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Dan Diebolt Sent: Wednesday, May 02, 2001 8:52 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Breadth First Traversal I need to traverse the attached XML *Breadth* First, at each a node calling template name="DoSomething". Identified by @id, the order needed is as follows: 1 1.1 1.2 1.3 1.1.1 1.1.2 1.1.3 1.2.1 1.2.2 1.2.3 1.3.1 1.3.2 1.3.3 1.1.1.1 1.1.1.2 1.1.1.3 1.1.2.1 1.1.2.2 1.1.2.3 1.1.3.1 1.1.3.2 1.1.3.3 1.2.1.1 1.2.1.2 1.2.1.3 1.2.2.1 1.2.2.2 1.2.2.3 1.2.3.1 1.2.3.2 1.2.3.3 1.3.1.1 1.3.1.2 1.3.1.3 1.3.2.1 1.3.2.2 1.3.2.3 1.3.3.1 1.3.3.2 1.3.3.3 Regards, Dan ----------------------- <a id="1"> <a id="1.1"> <a id="1.1.1"> <a id="1.1.1.1"/> <a id="1.1.1.2"/> <a id="1.1.1.3"/> </a> <a id="1.1.2"> <a id="1.1.2.1"/> <a id="1.1.2.2"/> <a id="1.1.2.3"/> </a> <a id="1.1.3"> <a id="1.1.3.1"/> <a id="1.1.3.2"/> <a id="1.1.3.3"/> </a> </a> <a id="1.2"> <a id="1.2.1"> <a id="1.2.1.1"/> <a id="1.2.1.2"/> <a id="1.2.1.3"/> </a> <a id="1.2.2"> <a id="1.2.2.1"/> <a id="1.2.2.2"/> <a id="1.2.2.3"/> </a> <a id="1.2.3"> <a id="1.2.3.1"/> <a id="1.2.3.2"/> <a id="1.2.3.3"/> </a> </a> <a id="1.3"> <a id="1.3.1"> <a id="1.3.1.1"/> <a id="1.3.1.2"/> <a id="1.3.1.3"/> </a> <a id="1.3.2"> <a id="1.3.2.1"/> <a id="1.3.2.2"/> <a id="1.3.2.3"/> </a> <a id="1.3.3"> <a id="1.3.3.1"/> <a id="1.3.3.2"/> <a id="1.3.3.3"/> </a> </a> </a> __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com 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








