RE: result-document from a temporary tree

Hi Andre, Michael

Apologies for joining in rather late, but I have exactly the
same problem in a different context, and agree with Andre's
critique of the prohibition on recursion. Perhaps my example may
tip the balance, since there is no parameterisation to confuse.

I am performing a chain of model transformations each encoded by
a template function, and returning its results to a variable
that then provides the input to the next transformation. So in a
C-like notation;

	model b = a2b(a);
	model c = b2c(b);
	model d = c2d(c);

Since my intervening models are complex, I wish to do validation
against my schemas, so I have a template function to validate
them.

    <xsl:template name="validate">
        <xsl:param name="document" as="document-node()"/>
        <xsl:param name="document-name" as="xs:string"/>
        <xsl:param name="schema-name" as="xs:string"/>
        <xsl:result-document href="{$document-name}">
            <xsl:copy-of select="$document"/>
        </xsl:result-document>
        <xsl:result-document href="check/{$document-name}">
            <xsl:call-template name="schema-check-summary">
                <xsl:with-param name="document" select="$document"/>
                <xsl:with-param name="document-name"
select="$document-name"/>
                <xsl:with-param name="flat-schema"
select="doc($schema-name)"/>
                <xsl:with-param name="schema-name" select="$schema-name"/>
            </xsl:call-template>
        </xsl:result-document>
    </xsl:template>

'document' : the current model is output for debug to
href="{$document-name}".
and the results of the validation against "doc($schema-name)"
to href="check/{$document-name}".

I can readily use this at the top-level as:

        <xsl:variable name="library-doc" as="document-node()">
            <xsl:call-template name="create-library"/>
        </xsl:variable>
        <xsl:call-template name="validate">
            <xsl:with-param name="document" select="$library-doc"/>
            <xsl:with-param name="document-name"
select="&quot;library.xml&quot;"/>
            <xsl:with-param name="schema-name"
select="&quot;LibrarySchema.xml&quot;"/>
        </xsl:call-template>
        <xsl:variable name="library" as="element()"
select="$library-doc/*"/>
	  ... continuing to use "library"

but I am unable to incorporate the above into a hierarchical calling
structure
since the call of validate is then within a temporary tree, and the converse
of requiring all nested hierarchical outputs to be exported to the top level
requires undue knowledge of the hierarchical structure at the top level.

	Regards
			
		Ed Willink

------------------------------------------------------------------------
E.D.Willink,                             Email: mailto:EdWillink@iee.org
Thales Research and Technology (UK) Ltd, Tel:  +44 118 923 8278 (direct)
Worton Drive,                            or  +44 118 986 8601 (ext 8278)
Worton Grange Business Park,             Fax:  +44 118 923 8399
Reading,   RG2 0SB
ENGLAND          http://www.computing.surrey.ac.uk/personal/pg/E.Willink
------------------------------------------------------------------------

Received on Tuesday, 11 May 2004 07:26:33 UTC