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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL attributes

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello, I shall make it short. My XML-document (local language):

<?xml version=&quot;1.0&quot; standalone=&quot;yes&quot; ?>
<?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;stylesheet2.xsl&quot;?>
<site>
<titel kleur=&quot;blue&quot;>Sander's Homepage</titel>
<tekst soort=&quot;arial&quot;>Welkom op mijn homepage!!!</tekst>
</site>

My XSL-stylesheet (stylesheet2.xsl):

<?xml version=&quot;1.0&quot; ?>
<xsl:stylesheet xmlns:xsl=&quot;<xsl:template match=&quot;/&quot;>
<xsl:apply-templates />
</xsl:template>
<xsl:template match=&quot;site&quot;>
<HTML>
<HEAD>
<TITLE>
<xsl:value-of select=&quot;//titel&quot;/>
</TITLE>
</HEAD>
<BODY>
<xsl:apply-templates />
</BODY>
</HTML>
</xsl:template>
<xsl:template match=&quot;titel&quot;>
<h1 align=&quot;center&quot;>
<font>
<xsl:attribute name=&quot;color&quot;>
<xsl:value-of select=&quot;@kleur&quot;/>
</xsl:attribute>
<xsl:value-of select=&quot;//titel&quot;/>
</font>
</h1>
</xsl:template>
<xsl:template match=&quot;tekst&quot;>
<font>
<xsl:attribute name=&quot;face&quot;>
<xsl:value-of select=&quot;@soort&quot;/>
</xsl:attribute>
<xsl:value-of select=&quot;//tekst&quot;/>
</font>
</xsl:template>
</xsl:stylesheet>

Problem: When i type green in XML by &quot;kleur&quot;, I get a blue color in my browser. And when I type red, I get black. It is the same thing with #FF0000 and #00FF00 etc.
Second problem: When I type Arial in XML by &quot;soort&quot;, I don't get any Arial font. It is the same thing with other fonts.
Question: What's wrong? Is it the browser (IE 5.0) or is it my XSL-file.

Thnx :)
 
Never mind, after six (!!!) hours I fixed it myself. For the people who want to know how, I changed in the XSL-stylesheet:

<font>
<xsl:attribute name=&quot;face&quot;>
<xsl:value-of select=&quot;@kleur&quot;/>
</xsl:attribute>
<xsl:value-of select=&quot;//titel&quot;/>
</font>

into:

<font>
<xsl:attribute name=&quot;style&quot;>
color: <xsl:value-of select=&quot;@kleur&quot;/>
</xsl:attribute>
<xsl:value-of select=&quot;//titel&quot;/>
</font>

However, thanx for checking this message, but I'ts already answered
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top