xsl-list
[Top] [All Lists]

xsl 2.0 recursive functions and return value

2006-02-26 10:32:49
hi everyone!


i'm trying to write a branching recursive function, but i have a problem with the "xsl:sequence" being non-terminating.

how can i get the following to work:


<xsl:function name="r2c:hasTextContent" as="xs:boolean">
  <xsl:param name="node"/>
    <xsl:for-each select="$node/*">
      <xsl:choose>
        <!--ignore!-->
        <xsl:when test="r2c:isOutputNode(.)"/>
        <!--gotcha!-->
        <xsl:when test="r2c:isLeafNode(.)">
          <xsl:value-of select="true()"/>
        </xsl:when>
        <xsl:otherwise>
        <!-- recurse into the current node -->
          <xsl:sequence select="r2c:hasTextContent(.)"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  <!-- no leafNodes found?:-->
  <xsl:sequence select="false()"/>
</xsl:function>

this will inevitably put more than one boolean into my output sequence, which will cause an error.

iiuc, either i need a re-settable variable (which xsl does not have), or a way to terminate the function after each xsl:sequence. i found references to xsl:result, but it seems to have gone the way of the dodo...

any hints?


jörn



--
jörn nettingsmeier

home://germany/45128 essen/lortzingstr. 11/
http://spunk.dnsalias.org
phone://+49/201/491621

if you are a free (as in "free speech") software developer
and you happen to be travelling near my home, drop me a line
and come round for a free (as in "free beer") beer. :-D

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>