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

Problem with using xsl:variable within a template in

Subject: Problem with using xsl:variable within a template in XSL1.0
From: "Gareth Howells" <subscriptions@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Dec 2007 11:33:48 -0000 (UTC)
 Problem with using xsl:variable within a template in
S'mee again (be honest, you'd miss me otherwise ;))

I had a stylesheet using <xsl:for-each> which worked perfectly. Within the
loop, there were several <xsl:variable> statements. Now that I've
converted the stylesheet to using templates these statements are causing a
stack trace.

The beginning of the original loop:

<xsl:for-each select="teamPlayers/teamPlayer">

<xsl:variable name="playerG"
select="//results[@week=$week]/playerResult[@player=current()]/g *
$gPoints" />
<xsl:variable name="playerA"
select="//results[@week=$week]/playerResult[@player=current()]/a *
$aPoints" />
<xsl:variable name="playerGDA"
select="//results[@week=$week]/playerResult[@player=current()]/gda *
$gdaPoints" />
<xsl:variable name="playerGDCS"
select="//results[@week=$week]/playerResult[@player=current()]/gdcs *
$gdcsPoints" />
<xsl:variable name="playerGDGA"
select="//results[@week=$week]/playerResult[@player=current()]/gdga *
$gdgaPoints" />

</xsl:for-each>

This has now been replaced with

<xsl:apply-templates select="teamPlayers/teamPlayer" mode="playerTable">

and

<xsl:template match="teamPlayer" mode="playerTable">

 { those variable declarations again }

</xsl:template>

I'm not sure if it's relevant, but the original for-each loop, and now the
apply-templates statement, is nested within a for-each loop, which itself
is nested within a for-each loop.

<xsl:for-each select="//results">
    <xsl:for-each select="//teams/team">
        <xsl:apply-templates select="teamPlayers/teamPlayer"
mode="playerTable" />
    </xsl:for-each>
</xsl:for-each>

The apply-templates statement is currently commented out, as is the entire
template other than the xsl:template and /xsl:template tags, and those
variable declarations, so I'm fairly sure they're whats causing the
problem. Is it not possible to define variables within a template?

Gareth

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.