在使用文档('')ServiceMix模块时,获取include href是空错误

时间:2012-06-06 08:10:00

标签: xslt apache-servicemix

我正在尝试在我的ServiceMix模块中使用XLST中的数组。

这是我的数组定义

<attr:Data>
    <Item1/>
    <Item2/>
    .
    .
    .
</attr:Data>

这就是我调用数组的方式

<xsl:for-each select="document('')/*/attr:Data/*">
...
</xsl:for-each>

它在Eclipse中运行良好,但是当我在ServiceMix中部署它时,我得到一个include href是空的TransformerException。 我尝试了net.sf.saxon.trans.XPathException和org.apache.xalan.processor.TransformerFactoryImpl处理器,我得到了同样的错误。我使用的ServiceMix版本是4.4.1-fuse-01-13。

1 个答案:

答案 0 :(得分:0)

我不知道ServiceMix,但它看起来好像没有设置样式表的基URI,这意味着文档('')不起作用。如果你不能改变ServiceMix调用转换的方式,那么你最好的选择可能是将数据放在一个全局变量中:

<xsl:variable name="data">
<attr:Data>
    <Item1/>
    <Item2/>
    .
    .
    .
</attr:Data>
</xsl:variable>

如果使用Saxon(XSLT 2.0),则以select="$data/attr:Data/*"访问,如果使用Xalan(XSLT 1.0)则以select="xx:node-set($data)/attr:Data/*"访问