jle Posted June 4, 2008 Share Posted June 4, 2008 Hi All,I am new to XSLT and sorry for the basic question.I have the following for loop in the xsl and my question next to the </td> in the for loop <xsl:for-each select="wx_l/wx"> <tr> <td class="list">buenos_aires</td> (my question : wx_name is here from xml file from <wx_name> ) <td class="grid"><img src="../images/bar.gif" width="30" height="10"/></td> (my question : width="80" from xml file node <cp>) <td class="list" align="right">88%</td> (my question : "right">88%</td> from xml file node <cp>) <td class="list" align="right"> </td> <td class="list" align="right">10</td> (my question : ="right">10 from xml file node <flan>) <td class="list" align="right">20</td> (my question : ="right">20 from xml file node <tlan>) <td class="list" align="right"> </td> </tr> </xsl:for-each>My questions are next to each <td>. Your help is greatly appreciated.JPBelow is my xml<wx_l><wx><wx_name>Endpoint1</wx_name><cp>80</cp><flan>10</flan><tlan>20</tlan></wx><wx>.............</wx_l> Link to comment Share on other sites More sharing options...
jle Posted June 4, 2008 Author Share Posted June 4, 2008 Hi all,I found the answers to most of the question except one question:I had the syntax error with the line below: <td class="grid"><img src="../images/bar.gif" width=<xsl:value-of select="cp"/> height="10"/></td>and I don't know how to fix. Please help.JP <xsl:for-each select="wx_l/wx"> <tr> <td class="list"><xsl:value-of select="wx_name"/></td> <td class="grid"><img src="../images/bar.gif" width=<xsl:value-of select="cp"/> height="10"/></td> <td class="list" align="right"><xsl:value-of select="cp"/>%</td> <td class="list" align="right"> </td> <td class="list" align="right"><xsl:value-of select="flan"/></td> <td class="list" align="right"><xsl:value-of select="tlan"/></td> <td class="list" align="right"> </td> </tr> </xsl:for-each> Link to comment Share on other sites More sharing options...
aalbetski Posted June 5, 2008 Share Posted June 5, 2008 <td class="grid"><img src="../images/bar.gif" width=<xsl:value-of select="cp"/> height="10"/></td>should be<td class="grid"><img src="../images/bar.gif" width="{cp}" height="10" /></td>the {} braces are designed for this purpose. To allow you to get a node value and embed into a attributealternately you could do this:<img><xsl:attribute name="src"><xsl:text>../images/bar.gif</xsl:text></xsl:attribute><xsl:attribute name="width"><xsl:value-of select="cp" /></xsl:attribute>etc... Link to comment Share on other sites More sharing options...
jle Posted June 5, 2008 Author Share Posted June 5, 2008 Thank you so very much! It works.Thanks a ton,JP Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.