我剛開始挖掘XProc(使用Calabash)。我想要將一系列XSLT轉換應用於單個輸入文檔以生成單個輸出文檔。我以前使用簡單的Python腳本來推動轉換,但似乎XProc可能是一個很好的選擇。如何簡化這個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>
這是一個恥辱。看起來這將是一個相當常見的用例,並且會有一些不太詳細的解決方案。 – 2010-10-08 19:57:45
@我會補充一點,我不是一位XProc專家......我剛剛瀏覽了規範和一些教程。我已經在我的願望清單上放了幾個月的XProc。 – LarsH 2010-10-08 20:10:20