2016-11-09 63 views
1

我已经建立了一个XProc管道,其中我有一个<p:xslt>步骤。 Amoung这个样式表的参数,我有一个参数,它是一个文档()节点:将文档()参数传递给XProc管道中的xslt

这是km_to_dita.xsl样式表:

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

    <xsl:param name="conf-base" select="'file:/D:/Temp/ALE_config/'" /> 

    <xsl:param name="output-base" select="''"/> 

    <xsl:param name="lang" select="/element()[1]/@language"/> 

    <xsl:param name="graphics-reference-names" as="document-node()*" /> 

    <!-- my templates stuff... --> 
</xsl:stylesheet> 

因此,我调用这个XSLT在我与管道接下来的步骤(用于演示目的,可以设定一个<p:inline>,但它旨在绑定到一个步骤的结果端口):

<p:xslt name="km-dm-to-dita"> 
    <p:input port="source"> 
     <p:pipe port="list-dm" step="list-csv"/> 
    </p:input> 
    <p:input port="stylesheet"> 
     <p:document href="km_to_dita.xsl"/> 
    </p:input> 
    <p:with-param name="output-base" select="$dita.data-dir"/> 
    <p:with-param name="conf-base" select="$config-dir"/> 
    <!--<p:with-param name="graphics-reference-names"> 
     <p:pipe port="result" step="get-figure-references"/> 
    </p:with-param>--> 
    <p:with-param name="graphics-reference-names"> 
     <p:inline> 
      <graphic-ids> 
       <reference type="symbol" document="dm09011b0281121ef3.xml#G4" filename="g09011b0281d9c449.gif"/> 
       <reference type="symbol" document="dm09011b0281121ef3.xml#G3" filename="g09011b0281d9c449.gif"/> 
       <reference type="figure" document="dm09011b0281121ef3.xml#F33" filename="g09011b0281d9c44d.gif"/> 
       <reference type="symbol" document="dm09011b0281121ef3.xml#G5" filename="g09011b0281d9c451.gif"/> 
       <reference type="figure" document="dm09011b0281121ef5.xml#F116" filename="g09011b0281d9c458.gif"/> 
      </graphic-ids> 
     </p:inline> 
    </p:with-param> 

    <p:with-option name="output-base-uri" select="$dita.data-dir"/> 
</p:xslt> 

但随着XML葫芦(在oXygenXML)运行时,它失败了,被提出错误的是(对不起乡亲这是我曾经的所有信息),但是已经确定,这是导致此错误)的<p:with-param name="graphics-reference-names">

任何想法?

回答

1

我终于找到了做什么用它去错了......首先,在<p:with-param>缺少必要的@select属性,如提及in the XProc,但奇怪的是氧气没有提出任何验证错误我的管道。

因此,管道可以是固定的那种方式:

必需项类型的变量$的值:

<p:with-param name="graphics-reference-names" select="/"> 
    <p:inline> 
     <graphic-ids> 
      <reference type="symbol" document="dm09011b0281121ef3.xml#G4" filename="g09011b0281d9c449.gif"/> 
      <reference type="symbol" document="dm09011b0281121ef3.xml#G3" filename="g09011b0281d9c449.gif"/> 
      <reference type="figure" document="dm09011b0281121ef3.xml#F33" filename="g09011b0281d9c44d.gif"/> 
      <reference type="symbol" document="dm09011b0281121ef3.xml#G5" filename="g09011b0281d9c451.gif"/> 
      <reference type="figure" document="dm09011b0281121ef5.xml#F116" filename="g09011b0281d9c458.gif"/> 
     </graphic-ids> 
    </p:inline> 
</p:with-param> 

通过上面的解决方案,因为该参数被铸造成一个字符串XSLT失败graphics-reference-names是document-node();提供的值具有项目类型的xs:串

这是另一个问题,使不可解问题:XPROC只允许参数将被设置为基本值,如在XSLT with XProc - parameter binding in the required type说明。