XSLT 2.0 - Saxon Result-document skip on error?
XSLT 2.0 - Saxon Result-document skip on error?
有这样的文件:
<?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???
XSLT 2.0 或 Saxon-HE 中没有 try/catch 功能。该工具存在于 XSLT 3.0 中(并且作为 XSLT 2.0 的 Saxon 扩展),但在这两种情况下,该工具在产品的免费版本中不可用。
有这样的文件:
<?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???
XSLT 2.0 或 Saxon-HE 中没有 try/catch 功能。该工具存在于 XSLT 3.0 中(并且作为 XSLT 2.0 的 Saxon 扩展),但在这两种情况下,该工具在产品的免费版本中不可用。