Re: [xsl] Recursive xsl parsing.

Subject: Re: [xsl] Recursive xsl parsing.
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Fri, 12 Jan 2001 10:27:17 +0000
Gurvan LeClecH wrote:
> Our
> objective is to recursively parse all documents until there are no more
> links to follow, and no more documents to parse. 
Here's a solution that works using pure XSLT (see if you're still using
Microsoft's previous experimental implementation).

The context is working with XML Schemas which can include other schemas
via an xsd:include element. The code is quite satisfactory in the sense
that by using nodesets it recurses through the include tree in a
parallel wave-front, rather than having to zip-zag sequentially round
every twist in the twig line :)


<xsl:template name="gatherSchema">
  <xsl:param name="schemas"/>
  <xsl:param name="includes"/>
    <xsl:when test="count($schemas) &lt; count($schemas | $includes)">
      <!-- when $includes includes something new, recurse ... -->
      <xsl:call-template name="gatherSchema">
        <!-- ... with current $includes added to the $schemas parameter
... -->
        <xsl:with-param name="schemas" select="$schemas | $includes"/>
        <!-- ... and any *new* includes in the $include parameter -->
        <xsl:with-param name="includes"
      <!-- do something with the "$schemas" nodeset containing the root
nodes of all included schemas -->

 XSL-List info and archive:

Current Thread