2017-07-25 46 views
0

我是Java新手。我有一个类似的场景为[Catch output stream of xsl result-document,但我不理解什么通过为href和基础参数..如何在Java中实现saxon OutputURIResolver?

我的XSLT(结果文档)如下:

<xsl:template match="/" mode="create-text-file"> 
     <xsl:param name="book-name" tunnel="yes"/> 

     <xsl:result-document href="{$book-name}.xml" 
      doctype-public=" test" 
      doctype-system="test.dtd"> 
      <xsl:apply-templates/> 
     </xsl:result-document> 
    </xsl:template> 

另:

<xsl:result-document href="{$book-name}.opf" 
          doctype-public="" 
          doctype-system="" 
          indent="yes"> 

      <xsl:apply-templates mode="#current"/> 
     </xsl:result-document> 

参数书的名字越来越为:

<xsl:template match="document-node()"> 
     <xsl:variable name="book-name" select="tps:get-file-name(document-uri(/))"/> 

能否请您给我解释一下无线这个结果文件?

在此先感谢。

回答

0

OutputURIResolver是一个回调:这意味着你提供解决()方法的实现,并呼吁萨克森您的实现。所以你不必担心要传递什么作为基础和href参数,因为你不称这种方法,撒克逊人会这样做。它通常将提供在href参数作为你的呼叫于xsl的href属性的(扩展的)值:结果文档,和基值将是“基地输出URI”,默认为提名作为主要输出的文件(命令行中的-o选项)。

+0

先生可以当我不使用命令行参数我们给出了一个文件夹路径或自定义位置为基础?而我所理解的是,如果我们提取了xslt zip包(根据我的场景),OutputURIResolver就是获取href值。 – user2490093

+0

如果使用s9api接口则可以使用所设置的基本输出URI'XsltTransformer.setBaseOutputURI()'。在JAXP中没有等价物,因为JAXP是为XSLT 1.0设计的。 –