This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Breaking up is hard to do.


> 2. Recursion using call-template.
>     Because call-template does not change the current node list
> I am unable to move or traverse the node list.
>     Each call to 'colCounter' generates three input fields, but only
> one has data output as there is only one element in the node
> list inside the called template.

There is a bug in your recursion code, I suppose.  Try something like
the following:

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

<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
  <xsl:call-template name="triples">
    <xsl:with-param name="nodes" select="/*/f"/>
  </xsl:call-template>
</xsl:template>

<xsl:template name="triples">
  <xsl:param name="nodes"/>
  <tr><td><xsl:value-of select="$nodes[1]"/></td>
      <td><xsl:value-of select="$nodes[2]"/></td>
      <td><xsl:value-of select="$nodes[3]"/></td></tr>
  <xsl:if test="count($nodes) > 3">
    <xsl:call-template name="triples">
      <xsl:with-param name="nodes" 
                      select="$nodes[position() > 3]"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>

</xsl:stylesheet>

  Steve


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]