[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

newbie prob - Template and navigation confusion???

Subject: newbie prob - Template and navigation confusion???
From: "Nick Roberts" <nick_roberts5@xxxxxxxxxxx>
Date: Thu, 03 Feb 2005 13:44:23 +0000
stadium template
I'm quite new the XSL and what i've have produced so far has taken some considerable time. I'm slowly getting used to the way templates work but i'm still having some probs with my code.

In the below code, there is a 'when' condition which states that the when the salary is greater than 30000, match the 'dark' template.. which sets the background colour of a table-box to grey.

Although this sort-of works, it seems to pick random boxes to turn grey, some which aren't above 30000, and others which are. Also, some which are over 30000 aren't turned grey??

I presume it must be something to do with the way i'm navigating through the xml document.

Can anyone spot any problems with the code?

Cheers, Nick


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


<xsl:template match="page">
<html>
<head><title>Footy stuff</title></head>
<body>
<h1>Football Report</h1><hr/>
<xsl:for-each select="ROWSET/ROW">
<h2><xsl:apply-templates select="TEAM/TEAM_ROW/TEAMNAME"/></h2>
<h3>Stadium: <xsl:apply-templates select="STADIUM"/></h3>
<table border="1">
<th><b>Last Name</b></th><th><b>Salary</b></th>
<xsl:choose>
<xsl:when test="TEAM/TEAM_ROW/NAME/NAME_ROW/SALARY&gt;'30000'">
<xsl:apply-templates select="TEAM/TEAM_ROW/NAME/NAME_ROW" mode="dark"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="TEAM/TEAM_ROW/NAME/NAME_ROW" mode="light"/>
</xsl:otherwise>
</xsl:choose>
</table>
<xsl:call-template name="break"/>
</xsl:for-each>
</body>
</html>
</xsl:template>


<xsl:template match="NAME_ROW" mode="dark">
<tr>
<td><xsl:value-of select="LAST_NAME"/></td><td bgcolor="gray"><xsl:value-of select="SALARY"/></td>
</tr>
</xsl:template>


<xsl:template match="NAME_ROW" mode="light">
<tr>
<td><xsl:value-of select="LAST_NAME"/></td><td><xsl:value-of select="SALARY"/></td>
</tr>
</xsl:template>


 <xsl:template name="break">
  <hr/>
 </xsl:template>

</xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.