DaveF
DaveF

Reputation: 173

xsl how do I apply a XML document as a variable to a template

I have this basic template which sorts & removes certain nodes from my XML document. It works as expected in a stand alone XSLT when passing the XML file as an input parameter of a Saxon command.

<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()">
            <xsl:sort select="RatingDate" order="descending"/>
        </xsl:apply-templates>
    </xsl:copy>
</xsl:template>

<xsl:template match="ChangesByServerID|Distance|NewRatingPending"/>

However, I want to include it in an existing XSL file where the XML file is loaded into a variable:

<xsl:variable name="BANES_326" select="document('FHRS_BANES_326.xml')"/>

How do I pass the XML variable to this routine?

Upvotes: 0

Views: 62

Answers (1)

Michael Kay
Michael Kay

Reputation: 163262

Simply do <xsl:apply-templates select="$BANES_236"/>

Upvotes: 0

Related Questions