[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] DSSSL->XSLT; problems implementing node-list-first/node-list-rest


Subject: Re: [xsl] DSSSL->XSLT; problems implementing node-list-first/node-list-rest
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 27 Mar 2001 10:41:52 +0100

Hi Aidan,

I think that your problem rests in the fact that when you first call
the proc-nl template, you're passing a result tree fragment (i.e. a
single root node) whereas in later calls you're passing a node set
containing a number of item elements.

You could pass all the item elements each time, so change the first
call (in the list-matching template) to:

  <xsl:call-template name="proc-nl">
     <xsl:with-param name="nl" select="saxon:nodeSet($sorted)/*" />
  </xsl:call-template>

and change the proc-nl template to:

<xsl:template name="proc-nl">
    <xsl:param name="nl"/>

    <called>
        <xsl:for-each select="$nl">
            <xsl:message>
                <xsl:copy-of select="."/>
            </xsl:message>
        </xsl:for-each>
    </called>

    <xsl:if test="$nl">
        <xsl:apply-templates select="$nl[1]"/>
        <foo>bar</foo>
        <xsl:call-template name="proc-nl">
            <with-param name="nl" select="$nl[position() != 1]"/>
        </xsl:call-template>
    </xsl:if>
</xsl:template>

Or change the proc-nl template so that it creates a new result tree
fragment to pass each time.  In other words, change the recursive call
within the proc-nl template to:

   <xsl:call-template name="proc-nl">
       <with-param name="nl">
          <xsl:copy-of
             select="saxon:nodeSet($nl)/*[position() != 1]" />
       </xsl:with-param>
   </xsl:call-template>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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



Current Thread