Xml 如何简化这个xproc管道?

Xml 如何简化这个xproc管道?,xml,pipeline,saxon,xproc,Xml,Pipeline,Saxon,Xproc,我刚刚开始深入研究XProc(使用)。我有一系列XSLT转换,希望应用于单个输入文档以生成单个输出文档。我之前使用了一个简单的Python脚本来驱动转换,但似乎XProc可能是一个很好的选择 下面的管道似乎适合我。它本质上只是一个需要按正确顺序应用的XSLT转换列表。问题是,这似乎是非常多余的。我希望有一些方法可以减少这种情况,但是(到目前为止)我自己无法解决 <?xml version="1.0"?> <p:pipeline version="1.0" xmlns:p="ht

我刚刚开始深入研究XProc(使用)。我有一系列XSLT转换,希望应用于单个输入文档以生成单个输出文档。我之前使用了一个简单的Python脚本来驱动转换,但似乎XProc可能是一个很好的选择

下面的管道似乎适合我。它本质上只是一个需要按正确顺序应用的XSLT转换列表。问题是,这似乎是非常多余的。我希望有一些方法可以减少这种情况,但是(到目前为止)我自己无法解决

<?xml version="1.0"?>
<p:pipeline version="1.0" xmlns:p="http://www.w3.org/ns/xproc">
    <p:xslt name="remove-locations">
        <p:input port="stylesheet">
            <p:document href="preprocessors/remove-locations.xsl"/>
        </p:input>
    </p:xslt>

    <p:xslt name="divisions-1">
        <p:input port="stylesheet">
            <p:document href="preprocessors/divisions-1.xsl"/>
        </p:input>
    </p:xslt>

    <p:xslt name="divisions-2">
        <p:input port="stylesheet">
            <p:document href="preprocessors/divisions-2.xsl"/>
        </p:input>
    </p:xslt>

    <p:xslt name="subjects-1">
        <p:input port="stylesheet">
            <p:document href="preprocessors/subjects-1.xsl"/>
        </p:input>
    </p:xslt>

    <p:xslt name="subjects-2">
        <p:input port="stylesheet">
            <p:document href="preprocessors/subjects-2.xsl"/>
        </p:input>
    </p:xslt>

    <p:xslt name="types-1">
        <p:input port="stylesheet">
            <p:document href="preprocessors/types-1.xsl"/>
        </p:input>
    </p:xslt>

    <p:xslt name="types-2">
        <p:input port="stylesheet">
            <p:document href="preprocessors/types-2.xsl"/>
        </p:input>
    </p:xslt>

    <p:xslt name="core">
        <p:input port="stylesheet">
            <p:document href="preprocessors/core.xsl"/>
        </p:input>
    </p:xslt>

    <p:xslt name="consolidate-descriptions">
        <p:input port="stylesheet">
            <p:document href="preprocessors/consolidate-descriptions.xsl"/>
        </p:input>
    </p:xslt>
</p:pipeline>

我找不到简化管道的方法。。。除非修改样式表本身。例如,制作一个导入所有其他样式表的样式表,并将一个样式表的输出传递给下一个样式表的输入。(这需要XSLT2.0或exsl:nodeset扩展。)

但是没有,我看不到在不修改其他内容的情况下简化XProc管道的方法。

我转向邮件列表寻求帮助,找到了一个快速、适合我的解决方案。这使我能够将上述管道简化为以下内容(更改名称空间以保护无辜者):



(实际上,我将step out分离到了它自己的文件中,并且
它,因此主管道文件甚至比这个文件更简单。)

这太可惜了。看起来这将是一个相当常见的用例,并且会有一些不太详细的解决方案。@威尔,我应该补充一点,我不是XProc专家。。。我刚刚浏览了说明书和一些教程。几个月来,我一直想加入XProc。
<?xml version="1.0"?>
<p:pipeline
    version="1.0"
    xmlns:p="http://www.w3.org/ns/xproc"
    xmlns:ex="http://example.com">

    <p:declare-step type="ex:xslt" name="xslt">
        <p:input port="source" sequence="true" primary="true"/>
        <p:input port="parameters" kind="parameter"/>
        <p:output port="result" primary="true"/>
        <p:option name="stylesheet" required="true"/>

        <p:load name="load-stylesheet">
            <p:with-option name="href" select="$stylesheet"/>
        </p:load>

        <p:xslt>
            <p:input port="stylesheet">
                <p:pipe port="result" step="load-stylesheet"/>
            </p:input>
            <p:input port="source">
                <p:pipe port="source" step="xslt"/>
            </p:input>
        </p:xslt>
    </p:declare-step>

    <ex:xslt stylesheet="remove-locations.xsl"/>
    <ex:xslt stylesheet="divisions-1.xsl"/>
    <ex:xslt stylesheet="divisions-2.xsl"/>
    <ex:xslt stylesheet="subjects-1.xsl"/>
    <ex:xslt stylesheet="subjects-2.xsl"/>
    <ex:xslt stylesheet="types-1.xsl"/>
    <ex:xslt stylesheet="types-2.xsl"/>
    <ex:xslt stylesheet="core.xsl"/>
    <ex:xslt stylesheet="consolidate-descriptions.xsl" />
</p:pipeline>