我正在使用XSLT (从终端触发)在它们自己的文件夹结构中构建两个单独的XHTML文档(例如“doc-1文件夹”、“doc-2文件夹”)。每次构建时,我都希望有一个“本地”输出,但我也添加了一个共享存储文件夹,希望输出也能到达该文件夹。
XSLT的每个触发器应该产生相同的输出文件两次,一个到它的本地文件夹,一个到共享文件夹。
希望复制文档构建的原因是,我将合并一些文档,并希望执行调用存储文件夹的合并。
一个简短的例子:
生产doc-1:
/doc-1-folder/myDoc-1.xhtml
/shared/storage/myDoc-1.xhtml生产doc-2:
/doc-2-folder/myDoc-2.xhtml
/shared/storage/myDoc-2.xhtml将在存储中生成:
/shared/storage/myDoc-1.xhtml
/shared/storage/myDoc-2.xhtml在这里阅读:https://www.saxonica.com/documentation10/index.html#!using-xsl/commandline,它似乎只能定义一个带有标志"-o“的输出文件。
可以定义几个输出文件吗?或者我需要创建几个XSLT脚本才能两次处理(相同的)输出?
发布于 2021-06-10 10:35:58
如果要在XSLT中完成所有这些操作,则可以使用逻辑。
<xsl:variable name="outputDoc">
... generate the output ...
</xsl:variable>
<xsl:result-document href="firstOutput.xml">
<xsl:copy-of select="$outputDoc"/>
</xsl:result-document>
<xsl:result-document href="secondOutput.xml">
<xsl:copy-of select="$outputDoc"/>
</xsl:result-document>如果您正在使用Java (s9api),那么通过编写一个ResultDocumentHandler将输出定向到一个net.sf.saxon.s9api.TeeDestination,它可以使输出动态地指向两个不同的位置,这样可能会更冒险,也更有效率。
https://stackoverflow.com/questions/67918862
复制相似问题