-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong base-uri(/*) returned with Saxon 9.7 and 9.8 under certain conditions #281
Comments
There’s a lot of complex behavior going on here (thank you 1.0e6 for the small, focused test case), the relevant bit of code is in // Before Saxon 9.8, it was possible to simply set the base uri of the
// output document. That became impossible in Saxon 9.8, but I still
// think there might be XProc pipelines that rely on the fact that the
// base URI doesn't change when processed by XSLT. So we're doing it
// the hard way.
TreeWriter fixbase = new TreeWriter(runtime);
fixbase.startDocument(document.getBaseURI());
fixbase.addSubtree(xformed);
fixbase.endDocument();
xformed = fixbase.getResult(); For some reason, that doesn’t work for your stylesheet. Deep in the guts of the In the course of misunderstanding the issue at first, I discovered that you can “fix” this bug by adding an explicit template for the document node to your stylesheet: <xsl:template match="/">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template> With that explicit copy, the Is that enough of a workaround for you? (I’ll pass this along to Saxonica, but I have no idea if it’s a bug or not.) |
Reported to Saxonica: https://markmail.org/thread/tsrtgohiby72v3ye |
…ource of problems
I tried it with Calabash 1.1.21 and Saxon PE 9.8.0.15. Still the same erroneous output. |
Should be fixed for Saxon 9.9: https://saxonica.plan.io/issues/3956#note-10 |
I put together a 1.1.25 for Saxon 9.9(.1-2). Can you download it from here and let me know if it appears correct to you? (I haven't pushed it to Maven Central yet.) |
Seems correct, at least for the example above. |
While many of our and our customers’ pipelines could be migrated from Calabash 1.1.15 with Saxon 9.6 to Calabash 1.1.21 with Saxon 9.8, I noticed a regression in a specific project. After hours of debugging, I managed to reproduce it with a minimal example.
The source in this example, Untitled2.xml, is
The pipeline, Untitled4.xpl, is
The XSLT, Untitled3.xsl, is:
What happens during the transformation is that
/*/@xml:base
is removed, and/doc/foo
is sent to the secondary port by anxsl:result-document
instruction.Invoking it with Calabash 1.1.22 with Saxon 9.8 or Calabash 1.1.19 with Saxon 9.7 like this:
gives the same incorrect results:
It is incorrect because the result does not have an
/*/@xml:base
attribute any more and thereforebase-uri(/*)
should be the same asbase-uri()
. Butbase-uri(/*)
is now the URI of the XSLT file. (It is not necessarily the URI of the XSLT file that contains thexsl:result-document
instruction. In this example, it is, because there is only a single XSLT file.)The correct output, produced with the Saxon-9.6 versions of XML Calabash 1.1.15 or 1.1.19, is:
It doesn’t matter that the attached XSLT is version 3.0, the same error occurs with 2.0.
The text was updated successfully, but these errors were encountered: