You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Максим Гумеров <mg...@gmail.com> on 2015/12/02 15:13:24 UTC

Is this a bug?

Hello!
I tried to transform the attached XML with the attached XSL.
This is the Java source:

final TransformerFactory trf = TransformerFactory.newInstance();
final Transformer tr = trf.newTransformer(new
StreamSource(_formxsl.getInputStream()));
tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
tr.setOutputProperty(OutputKeys.INDENT, "no");


StringWriter writer = new StringWriter();
final StreamResult result = new StreamResult(writer);
tr.transform(new StreamSource(_formxml.getInputStream()), result);
writer.flush();
writer.toString();


_formxsl and _formxml are both Resource, they are attached to this message.

The transform result by
http://xslt.online-toolz.com/tools/xslt-transformation.php (*AND*
http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog)
looks like this:

<?xml version="1.0"?>
<ros:relobjects
xmlns:ros="urn://x-artefacts-vs-it-ru/p321/schema/relobjects/1.0"
xmlns:bo="urn://x-artefacts-it-ru/p321/Application/1.0"
xmlns:fo="urn://x-artefacts-it-ru/p321/Step2Form/1.0"
xmlns:ct="urn://x-artefacts-it-ru/p321/ComplexTypes/1.0"
xmlns:st="urn://x-artefacts-it-ru/p321/SimpleTypes/1.0"
xmlns:da="urn://x-artefacts-it-ru/dob/document-attachment/1.1"><ros:RO
type="VEHICLE_OWNER_DRIVER" id="5672f6f9-176e-42cb-ae76-de1973a77bde">
<ros:BO role="VEHICLE"/>
<ros:BO role="OWNER"/>
<ros:BO role="DRIVER">76bd59e9-166c-4a22-9e6b-b196849be358</ros:BO>
<ros:BO role="DRIVER">5fb19f85-0617-4782-9a4f-fdc2a60c5e64</ros:BO>
<ros:BO role="DRIVER">f39bafdc-7fab-472d-965e-398e87a1472a</ros:BO>
</ros:RO></ros:relobjects>

But the result produced by Java is merely this:

<ros:relobjects
xmlns:ros="urn://x-artefacts-vs-it-ru/p321/schema/relobjects/1.0"
xmlns:da="urn://x-artefacts-it-ru/dob/document-attachment/1.1"
xmlns:st="urn://x-artefacts-it-ru/p321/SimpleTypes/1.0"
xmlns:ct="urn://x-artefacts-it-ru/p321/ComplexTypes/1.0"
xmlns:fo="urn://x-artefacts-it-ru/p321/Step2Form/1.0"
xmlns:bo="urn://x-artefacts-it-ru/p321/Application/1.0"><ros:RO
type="VEHICLE_OWNER_DRIVER"
id="5672f6f9-176e-42cb-ae76-de1973a77bde"/></ros:relobjects>
*- i.e. no BO elements at all.*

Why does this happen? Is there some mistake or undefined behavior in my
stylesheet?

Thank you!
Maksim