|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Re: Maintaining Heirarchy and using Recursion to w
Thanks very much. Since i need to put icons for every child, i was thinking it would be better for me to process each node separately and not to use a *. Here is the XSL code i wrote to take care of recursion. Is there a way to indent each child based on depth? I can get the depth with "count(ancestor::*)". The output would still be: DataContainer_1 integerField_1 decimalField_1 dateField_1 DataContainer_1_1 textField_1_1 integerField_1_1 DataContainer_1_1_1 textField_1_1_1 integerField_1_1_1 XSL: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="HSDataContainerType"> <xsl:for-each select="//HSDataContainerType"> <div><b><xsl:value-of select="@name"/></b></div> <xsl:value-of select="count(ancestor::*)"/> <xsl:for-each select="./HSString"> <div style="margin-left: 4em;"><xsl:value-of select="@name"/></div> </xsl:for-each> <xsl:for-each select="./HSDouble"> <div style="margin-left: 4em;"><xsl:value-of select="@name"/></div> </xsl:for-each> <xsl:for-each select="./HSBoolean"> <div style="margin-left: 4em;"><xsl:value-of select="@name"/></div> </xsl:for-each> <xsl:for-each select="./HSBinary"> <div style="margin-left: 4em;"><xsl:value-of select="@name"/></div> </xsl:for-each> <xsl:for-each select="./HSInteger"> <div style="margin-left: 4em;"><xsl:value-of select="@name"/></div> </xsl:for-each> <xsl:for-each select="./HSDate"> <div style="margin-left: 4em;"><xsl:value-of select="@name"/></div> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet> -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jarno.Elovirta@xxxxxxxxx Sent: Tuesday, June 24, 2003 10:38 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: Re: Maintaining Heirarchy and using Recursion to write an XSL Hi, > I don't know the number of <HSDataContainerType> tags i could > inside one > another. I am trying to display the output (HTML) thru my XSL like: > > DataContainer_1 > integerField_1 > decimalField_1 > dateField_1 > DataContainer_1_1 > textField_1_1 > integerField_1_1 > DataContainer_1_1_1 > textField_1_1_1 > integerField_1_1_1 <xsl:template match="HSContract"> <html> <head> <title/> </head> <body> <xsl:apply-templates select="*"/> </body> </html> </xsl:template> <xsl:template match="HSDataContainerType"> <div> <xsl:value-of select="@name"/> </div> <div style="margin-left: 4em;"> <xsl:apply-templates select="*"/> </div> </xsl:template> <xsl:template match="*"> <div> <xsl:value-of select="@name"/> </div> </xsl:template> Cheers, Jarno - SITD: Laughingstock XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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








