xsl-list
[Top] [All Lists]

RE: xslt processing XML file by applying multiple transformation

2005-01-11 21:41:10




Hello,
I have an XML document that i need to transform into
another XML document. To do that, I need to first
tranform the original XML document using one xsl file.
The the output XML generated in the first translation,
I need to again transform it to another XML using a
second xsl file.

If possible, I want to do this by using a single xsl
file where i would somehow do the first translation
and then pass the whole result document throught a
second translation.

u betcha!  In XSLT 2.0:

        <xsl:template mode="pass1" match="/">
                .
                .
        </xsl:template>

        <xsl:template mode="pass2" match="/">
                .
                .
        </xsl:template>

        <xsl:variable name="pass1-result">
           <xsl:apply-templates mode="pass1" select="/" />
        </xsl:variable>

        <xsl:template match="/">
           <!-- see note below -->
           <xsl:apply-templates
                   mode="pass2"
                   select="$pass1-result"
        </xsl:template>

In XLST 1.0, the select attribute would be

        select="exslt:node-set($pass1-result)"

where

        xmlns:exslt="http://exlst.org/common";

HTH,
- mark



--~------------------------------------------------------------------
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>
--~--