Piotr Dajlido
Piotr Dajlido

Reputation: 2030

XSLT 2.0 - Saxon Result-document skip on error?

Having file like this :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs">

    <xsl:import href="file0.xsl"/>
    <xsl:import href="file1.xsl"/>
    <xsl:import href="file2.xsl"/>

    <xsl:output indent="yes"/>

    <xsl:template match="/">
        <root>
            <xsl:result-document href="../xml/file0.xml" method="xml">
                <xsl:call-template name="file0"/>
            </xsl:result-document>

            <xsl:result-document href="../xml/file1.xml" method="xml">
                <xsl:call-template name="file1"/>
            </xsl:result-document>

            <xsl:result-document href="../xml/file2.xml" method="xml">
                <xsl:call-template name="file2"/>
            </xsl:result-document>
        </root> 
    </xsl:template>

</xsl:stylesheet>

Q: I'm wandering if there is a way to continue transformation if one of the result-document elements fail to execute.

e.g. file1.xsl throws an error in template file1, will the file2 template be executed???

Upvotes: 1

Views: 518

Answers (1)

Michael Kay
Michael Kay

Reputation: 163312

There's no try/catch capability in XSLT 2.0 or in Saxon-HE. The facility is present in XSLT 3.0 (and as a Saxon extension to XSLT 2.0), but in both cases, that's not available in the free version of the product.

Upvotes: 3

Related Questions