Eclipse从xsl Transformation生成空xml输出

时间:2016-09-28 10:13:21

标签: xml eclipse xslt xslt-1.0

我正在使用已知书籍的例子。

xml输入:

<?xml version="1.0" encoding="UTF-8"?>
<reference>
<body>
<title>xsl:stylesheet</title>
<purpose>
<p>The root element of a stylesheet.</p>
</purpose>
<usage>
<p>The <element>stylesheet</element> is always the root element, even if
a stylesheet is included in, or imported into, another. It must have a
<attr>version</attr> attribute, indicating the version of XSLT that the
stylesheet requires.</p>
<p>For this version of XSLT, the value should normally be "2.0". For a
stylesheet designed to execute under either XSLT 1.0 or XSLT 2.0, create a core
module for each version number; then use <element>xsl:include</element> or
<element>xsl:import</element> to incorporate common code, which should specify
<code>version="2.0"</code> if it uses XSLT 2.0 features, or
<code>version="1.0"</code> otherwise.</p>
<p>The <element>xsl:transform</element> element is allowed as a synonym.</p>
<p>The namespace declaration <code>xmlns:xsl="http//www.w3.org/1999/XSL/
Transform</code> by convention uses the prefix <code>xsl</code>.</p>
<p>An element occurring as a child of the <element>stylesheet</element>
element is called a declaration. These top-level elements are all optional, and
may occur zero or more times.</p>
</usage>
</body>
</reference>

简单的,用于转换的空xsl文件:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
</xsl:stylesheet>

在Eclipse Neon上运行上面的内容时,(通过选择两个文件并选择Run As -> XSL Transformation我得到一个空的xml文件(显然它应该输出所有文本节点)(如同输出一样) this online tool

有什么问题?

1 个答案:

答案 0 :(得分:0)

事实证明,整个事情与我在同一目录中有另一个xslt文件有关。

Eclipse显然使用了所谓的转换管道,因此这两个文件都用于转换。