XML Development

Moderators: None (Apply to moderate this forum)
Number of threads: 252
Number of posts: 451

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
XSL Concatenate 3 values - having trouble! Posted by sethwb on 20 Dec 2010 at 3:40 PM
QUESTION: The attributes for height and width appear in the rendered HTML, however the specified Background-color is not showing up. Any ideas why this might be?

EXAMPLE OF XML:
<?xml version="1.0" encoding="UTF-8"?>
<channel>
    <title>Colour Guide</title>
    <link></link>
    <description>hi</description>
    <lastBuildDate>Mon, 13 Dec 2010 12:14:59 GMT</lastBuildDate>
    <image>
        <title>hello</title>
        <url>pages/pagethirtytwo/subsection</url>
        <link></link>
    </image>
    <item>
        <title>Player 12</title>
        <link></link>
        <ref id="80-2563">
            <shortdesc>Midfield, Defense</shortdesc>
            <longdesc>Midfield Defensive player.</longdesc>
            <L>87.04</L>
            <A>-4.3</A>
            <B>84.39</B>
            <R>239</R>
            <G>216</G>
            <B2>33</B2>
        </ref>
    </item>
</channel>



XSLT code that is giving me trouble:
<xsl:for-each select="ref"><td><xsl:attribute name="style"><![CDATA[height:12px;width:12px;[B]background-color:(]]><xsl:value-of select = "concat(R,',',G,',',B2)" /><![CDATA[)]]>[/b]</xsl:attribute></td></xsl:for-each>


Full code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
	<xsl:template match="/">
	  <xsl:apply-templates select="channel" />
	  <xsl:call-template name="items"/>
	</xsl:template>
	<xsl:template match="channel">
		<div class="ChannelTitle">
		  <h1><xsl:element name="a"><xsl:attribute name="title"><xsl:value-of disable-output-escaping="yes" select="title" /></xsl:attribute><xsl:attribute name="href"><xsl:value-of disable-output-escaping="yes" select="link" /></xsl:attribute></xsl:element></h1>
		  <h3><xsl:value-of disable-output-escaping="yes" select="description" /></h3>
		</div>
	</xsl:template>
	<xsl:template name="items">
		<xsl:for-each select="channel/item">
		  <div class="Article">
		    <h3 id="ArticleTitle"><xsl:element name="a"><xsl:attribute name="title"><xsl:value-of disable-output-escaping="yes" select="title" /></xsl:attribute><xsl:attribute name="href"><xsl:value-of disable-output-escaping="yes" select="link" /></xsl:attribute></xsl:element></h3>
		    <p id="ArticleDescription">
		    	<table cellspacing="0" cellpadding="0" border="0">
					<tr>
						<xsl:for-each select="ref"><td><xsl:attribute name="style"><![CDATA[height:12px;width:12px;background-color:(]]><xsl:value-of select = "concat(R,',',G,',',B2)" /><![CDATA[)]]></xsl:attribute> <xsl:value-of select = "concat(R,',',G,',',B2)" /> </td></xsl:for-each>
					</tr>
				</table>
			</p>
		  </div>
	  	</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>



Thanks,
Seth



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.