Bug #4929
closedUnexpected transformation result when (identity) transforming to XMLStreamWriterDestination
100%
Description
Hi,
When I execute an identity XSLT transformation to an XMLStreamWriterDestination using the s9api (Saxon Java 10.3) the result of the transformation differs from it's input. Some attributes are removed, other attributes are renamed to the local name of the containing element.
I've created a small Java code example that reproduces the problem. The source XML and XSLT files are also attached. When you run this testcase all "deltaxml:deltaV2" attributes are removed and the attributes "deltaxml:ordered" and "deltaxml:key" seem to be renamed to the local name of their containing element.
package test;
import java.io.File;
import java.io.FileOutputStream;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.stream.StreamSource;
import net.sf.saxon.s9api.Processor;
import net.sf.saxon.s9api.Serializer;
import net.sf.saxon.s9api.XdmNode;
import net.sf.saxon.s9api.XsltExecutable;
import net.sf.saxon.stax.XMLStreamWriterDestination;
public class Test {
public static void main(String[] args) {
try {
Processor processor = new Processor(false);
XdmNode inputDoc = processor.newDocumentBuilder().build(new File("renvooi-pre.xml"));
try (FileOutputStream fos = new FileOutputStream(new File("renvooi-pre-out.xml")) ) {
Serializer serializer = processor.newSerializer(fos);
XMLStreamWriter xsw = serializer.getXMLStreamWriter();
XsltExecutable executable = processor.newXsltCompiler().compile(new StreamSource(new File("identity.xsl")));
executable.load30().applyTemplates(inputDoc, new XMLStreamWriterDestination(xsw));
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
Kind regards, Maarten Kroon
Files
Updated by Michael Kay over 3 years ago
- Status changed from New to In Progress
Sorry for the delay in responding to this. I've added this as a test case and reproduced the problem. It looks like none of our test for XMLStreamWriter
output were using namespaced attributes.
Updated by Michael Kay over 3 years ago
- Category set to JAXP Java API
- Status changed from In Progress to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch trunk added
- Fix Committed on Branch 10, trunk added
A simple coding error in ReceiverToXMLStreamWriter.startElement()
Updated by O'Neil Delpratt over 3 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 10.5 added
Bug fix applied to Saxon 10.5 maintenance release.
Please register to edit this issue