1

I am using the example of a known book.

xml input:

<?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>

simple, empty xsl file for the transformation:

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

When running the above on Eclipse Neon, (by selecting both files and opting for Run As -> XSL Transformation I get an empty xml file (while it is obvious that it should output all the text nodes (as is the output from e.g. this online tool)

What is wrong?

pkaramol
  • 16,451
  • 43
  • 149
  • 324
  • Do you want to know WHY your stylesheet isnt evaluting the build-in rule for output only text while no templates are defined? [Build-in Template Rules](https://www.w3.org/TR/xslt#built-in-rule) OR do you want to get the text output in a more suited way? – uL1 Sep 28 '16 at 10:36
  • Add `` in your `` and execute via Eclipse Neon. – uL1 Sep 28 '16 at 10:39
  • You are obviously working with a non-conformant XSLT processor. Can you identify it more precisely? http://stackoverflow.com/questions/25244370/how-can-i-check-which-xslt-processor-is-being-used-in-solr/25245033#25245033 – michael.hor257k Sep 28 '16 at 10:58
  • Apache Software Foundation (Xalan XSLTC)1.0 – pkaramol Sep 28 '16 at 11:07

1 Answers1

0

It turns out the whole thing had to do with me having another xslt file in the same directory.

Eclipse apparently uses a so called transformation pipeline, so both files were used for the transformation.

pkaramol
  • 16,451
  • 43
  • 149
  • 324