Support #4731


Oxygen SaxonPE vs SaxonPE Transform

Added by Raymond Lillibridge almost 2 years ago. Updated almost 2 years ago.

Start date:
Due date:
% Done:


Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:


Using Java -version: openjdk 10.0.2 2018-07-17, OpenJDK Runtime Environment 18.3 (build 10.0.2+13), OpenJDK 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

Using Saxon-PE from Saxonica CMD>java net.sf.saxon.Transform

Produces different output compared to using the same (xsl and data) Transform in Oxygen Editor 22.1 using SaxonPE

The Oxygen Transform is producing correct output but I need to run production Transforms via a Windows Batch file, using the java net.sf.saxon.Transform command.

Files (1.05 MB) Sample files for Support #4731 Raymond Lillibridge, 2020-09-11 17:13
Actions #1

Updated by Michael Kay almost 2 years ago

I can't think of any obvious reason why the two environments should produce different results, but we'll certainly be happy to investigate if you can supply a repro (that is, stylesheet, source document, expected results, and any dependencies such as Java extension functions.)

Actions #2

Updated by Raymond Lillibridge almost 2 years ago

When the zip file is unzipped, it should create a top-level folder named Municode. In this folder is a PNG snap-shot of the diffing results for the two outputs I am getting when I run from the command line and Oxygen.

If you cd to the Job folder, you will find Sample Outputs, which contains the two different outputs I'm getting.

Running the SaxonDebug.bat from the Job folder will generate a new "bad" example (I'm using SaxonPE9.9.1.7J from the command line.)

Actions #3

Updated by Michael Kay almost 2 years ago

I had to move the .txt file to get this to run, and I also needed to make adjustments (on my MAC) to stop the .DSStore files in the input directory being processed.

With those changes I have run the transformation successfully and it produces the output reported.

From the -T trace output, the first tr element where the attribute differences are reported is generated by the literal result element at line="544" column="7" module="MCC_cals2html.xsl", which generates the style attribute from variable $rowStyle , which in turn comes from $rowFontWeightStyle, which takes the value from the data passed in to parameter $map_setrow_fv. This value is initialized at line 174. Adding an xsl:message, it appears to have the value:

<entry key="1">font-weight:bold;</entry>
<entry key="2">font-style:italic;</entry>
<entry key="3">font-weight:bold; font-style:italic;</entry>
<entry key="4">font-style:normal; font-weight:normal</entry>

The code is selecting one of these entries based on the value of position().

The -T output shows that the template rule with match="row|caprow" is invoked from xsl:apply-templates at line 488, which defaults to select="node()", and that it is selecting whitespace text nodes as well as row elements. So the position count includes the whitespace text nodes.

Presumably, because of some configuration settings, Oxygen is running the transformation with whitespace text nodes stripped, although the stylesheet specifies <xsl:preserve-space elements="*"/>. If I change this to strip-space, the output is the same as the Oxygen output.

I would recommend two changes (either on its own is sufficient):

  • Change the stylesheet to use xsl:strip-space elements="*"

  • Change the xsl:apply-templates instruction at line 488 to say select="*" so it only processes child elements, skipping any whitespace text node interspersed between the elements.

Actions #4

Updated by Raymond Lillibridge almost 2 years ago

Thank you, kind Sir! Works like a charm!

Actions #5

Updated by Michael Kay almost 2 years ago

  • Status changed from New to Closed
  • Assignee set to Michael Kay
  • Priority changed from High to Normal

Please register to edit this issue

Also available in: Atom PDF