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 http://www.netcrucible.com/xslt/msxml-faq.htm 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 :) Francis. <xsl:template name="gatherSchema"> <xsl:param name="schemas"/> <xsl:param name="includes"/> <xsl:choose> <xsl:when test="count($schemas) < 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" select="document($includes/xsd:schema/xsd:include/@schemaLocation)"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <!-- do something with the "$schemas" nodeset containing the root nodes of all included schemas --> </xsl:otherwise> </xsl:choose> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Recursive xsl parsing., Jeni Tennison | Thread | [xsl] Using CSS with XSL stylesheet, Joshua . Kuswadi |
RE: [xsl] Compound Keys Problem., Dimitre Novatchev | Date | Re: [xsl] Testing by counting or po, Francis Norton |
Month |