Support #4731
closedOxygen SaxonPE 9.9.1.7 vs SaxonPE 9.9.1.7J Transform
0%
Description
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 9.9.1.7J 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 9.9.1.7
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
Updated by Michael Kay about 4 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.)
Updated by Raymond Lillibridge about 4 years ago
- File Municode.zip Municode.zip added
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.)
Updated by Michael Kay about 4 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 sayselect="*"
so it only processes child elements, skipping any whitespace text node interspersed between the elements.
Updated by Raymond Lillibridge about 4 years ago
Thank you, kind Sir! Works like a charm!
Updated by Michael Kay about 4 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