Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL Font issue

Status
Not open for further replies.

acsooley

Programmer
Nov 13, 2002
32
CA
I want the xsl to get the class and color I want to use on each line but it is only using the class and color from the first <ln> in the XML. Do you know of any way that the xsl can use whatever class and color that is defined in the <ln> of the XML file. Please look below for an example of what I am talking about. If you have any questions please let me know.

My xml doc looks like:

<information>
<top>
<ln class=&quot;text10&quot; color=&quot;#003366&quot;>this is a line test</ln>
<ln class=&quot;text12&quot; color=&quot;#cc0033&quot;>this is another line test</ln>
</top>

</information>


My XSL looks like:

<xsl:for-each select&quot;/information/top/ln&quot;>
<font class=&quot;{information/top/ln/@class}&quot; color=&quot;{information/top/ln/@color}&quot;>
<xsl:value-of=&quot;.&quot;/>
</xsl:for-each>
 
this should work:

<xsl:template match=&quot;/&quot;>
<root>
<xsl:for-each select=&quot;information/top/ln&quot;>
<font class=&quot;{./@class}&quot; color=&quot;{./@color}&quot;>
<xsl:value-of select=&quot;.&quot;/>
</font>
</xsl:for-each>
</root>
</xsl:template>
 
Thanks alot this worked and solved my problem I have had for quite a while.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top