Subject: Re: [xsl] Trying to undestand why template works From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 23 Feb 2006 13:02:29 -0500 |
Doesn't "position() > 1" evaluate to either 0 or 1?
Cheers, Wendell
<xsl:template name="sum-value">
<xsl:param name="node"/>
<xsl:param name="hourVal"/>
<xsl:choose>
<xsl:when test="$node">
<xsl:variable name="recursive_result">
<xsl:call-template name="sum-value">
<xsl:with-param name="node" select="$node[position() > 1]"/>
<xsl:with-param name="hourVal" select="$hourVal"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$recursive_result + number($node[1]/@time *
$hourVal)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
I just don't understand how the select="$node[position() > 1]" bit works. I assume that with each recursion this is selecting the next child of the input node (param "node"), but have no idea how or why.
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Trying to undestand why templ, yguaba | Thread | Re: [xsl] Trying to undestand why t, Jon Gorman |
RE: [xsl] How to prevent that XML a, Wendell Piez | Date | [xsl] Trying to undestand why templ, yguaba |
Month |