Eclipse从xsl Transformation生成空的xml输出



我以一本已知的书为例。

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文件(虽然很明显,它应该输出所有文本节点(就像这个在线工具的输出一样)

怎么了?

原来整个事情都与我在同一目录下有另一个xslt文件有关。

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

相关内容

  • 没有找到相关文章

最新更新