-
Bug
-
Resolution: Unresolved
-
P4
-
17, 19, 20
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
JDK 21 EA, Windows 11
A DESCRIPTION OF THE PROBLEM :
In XPath you can return combined nodes using /*[self::a or self::b]. That OR operator can be replaced with pipe /*[self::a | self::b]. However, Java implementation in some cases returns different results for these operators. From my test cases, I deduce it is rather an edge case. But this unreliability pushes me to prefer 3rd party library (saxon).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Clone my repo
2. Run BadTransformer.java
3. Inspect the output (it is incorrect, see below)
Btw, the same combining syntax is used also in CorrectTransformer and XPathTester, where it works properly.
To see a mystery:
4. On line 41 replace:
<xsl:template match="link | inlinemediaobject | comment()" priority="10">
with
<xsl:template match="link | comment()" priority="10">
5. Run the transformation again.
6. Inspect the output (now it is correct!)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
<?xml version="1.0" encoding="UTF-8"?><simplelist>
<member>0-0-0-0-other<inlinemediaobject/>1-0-1-1-space<link/></member>
<member>0-0-0-0-other<inlinemediaobject/>1-0-1-1-space<!--comment-->0-1-1-1-space<link/></member>
<member>0-0-0-0-other<inlinemediaobject/>XXX0-0-0-0-other<link/></member>
</simplelist>
ACTUAL -
<?xml version="1.0" encoding="UTF-8"?><simplelist>
<member>0-0-0-0-other<inlinemediaobject/>1-0-0-1-element<link/></member>
<member>0-0-0-0-other<inlinemediaobject/>1-0-0-1-element<!--comment-->0-1-1-1-space<link/></member>
<member>0-0-0-0-other<inlinemediaobject/>XXX0-0-0-0-other<link/></member>
</simplelist>
---------- BEGIN SOURCE ----------
See the attached zip file.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Avoid OR operator in favor of pipe. Use a third-party XSLT transformer.
FREQUENCY : always
JDK 21 EA, Windows 11
A DESCRIPTION OF THE PROBLEM :
In XPath you can return combined nodes using /*[self::a or self::b]. That OR operator can be replaced with pipe /*[self::a | self::b]. However, Java implementation in some cases returns different results for these operators. From my test cases, I deduce it is rather an edge case. But this unreliability pushes me to prefer 3rd party library (saxon).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Clone my repo
2. Run BadTransformer.java
3. Inspect the output (it is incorrect, see below)
Btw, the same combining syntax is used also in CorrectTransformer and XPathTester, where it works properly.
To see a mystery:
4. On line 41 replace:
<xsl:template match="link | inlinemediaobject | comment()" priority="10">
with
<xsl:template match="link | comment()" priority="10">
5. Run the transformation again.
6. Inspect the output (now it is correct!)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
<?xml version="1.0" encoding="UTF-8"?><simplelist>
<member>0-0-0-0-other<inlinemediaobject/>1-0-1-1-space<link/></member>
<member>0-0-0-0-other<inlinemediaobject/>1-0-1-1-space<!--comment-->0-1-1-1-space<link/></member>
<member>0-0-0-0-other<inlinemediaobject/>XXX0-0-0-0-other<link/></member>
</simplelist>
ACTUAL -
<?xml version="1.0" encoding="UTF-8"?><simplelist>
<member>0-0-0-0-other<inlinemediaobject/>1-0-0-1-element<link/></member>
<member>0-0-0-0-other<inlinemediaobject/>1-0-0-1-element<!--comment-->0-1-1-1-space<link/></member>
<member>0-0-0-0-other<inlinemediaobject/>XXX0-0-0-0-other<link/></member>
</simplelist>
---------- BEGIN SOURCE ----------
See the attached zip file.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Avoid OR operator in favor of pipe. Use a third-party XSLT transformer.
FREQUENCY : always