p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   div hiererchy (http://p2p.wrox.com/showthread.php?t=54593)

gantait February 26th, 2007 11:22 AM

div hiererchy
 
<node>
 <child name="1st"/>
 <child name="2nd"/>
 <child name="3rd"/>
</node>

i want to make a html from this xml..which will be like that..
<div><table><tr><td><img src="images/blank.png"><img src="images/I.png">1st</td></tr></table>
       <div><table><tr><td><img src="images/blank.png"><img src="images/I.png"><img src="images/I.png">2nd</td></tr></table>
        <div> <table><tr><td><img src="images/blank.png"><img src="images/I.png"><img src="images/I.png"><img src="images/I.png">3rd</td></tr></table>
</div>
</div>
</div>

means the in order as child of node will give as hiererchy div structure...and <img src="images/I.png"> this will be increase by one..can anybody pls tell me the xsl structure...


mhkay February 26th, 2007 11:35 AM

Something like

<xsl:template match="child">
 <div><table><tr><td>
 <img src="images/blank.png"/>
 <img src="images/blank.png"/>
 <xsl:for-each select="preceding-sibling::*">
   <img src="images/blank.png"/>
 </xsl:for-each>
 <xsl:value-of select="."/>
</xsl:template>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

gantait February 26th, 2007 12:21 PM

i hav etried like this..


my childs are under path...data/dataSource

<xsl:template match="data/dataSource">
                 <div id="treeNode{position()}" style="display:none"><table border="0" cellspacing="0" cellpadding="0"><tr><td><img class="hiericon" src="images/blank.png"/><img class="hiericon" src="images/blank.png"/><img class="hiericon" src="images/I.png"/><img class="hiericon" src="images/I.png"/>
                     <xsl:for-each select="preceding-sibling::*">
                           <img class="hiericon" src="images/I.png"/>
                     </xsl:for-each>
                     <xsl:value-of select="@name"/>
                 </td></tr></table>
                 </div>
            </xsl:template>

and when parsing time in the perticular div where this display this will come there i have puted this code...but is not working...i have done mistake..pls correct me..

mhkay February 26th, 2007 12:27 PM

I'm sorry, but I haven't got a clue what this means:

and when parsing time in the perticular div where this display this will come there i have puted this code...

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

gantait February 26th, 2007 11:47 PM

actually wat code u have given to me...with that i have tried like this way..uder the perticular node where i have to make this logic i have puted the template there..and posted to u the code that i'm implementing..but i'm not getting it .and for those things i have really no idea..thnx for ur help



All times are GMT -4. The time now is 01:33 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.