Maksim, I'm far from expert at this stuff. But if you expected the
translation to process more than one matched item, shouldn't that template
be using <xsl:apply-templates> somewhere?  If I read the example template
correctly, it will find the first match to '*', copy that item to output,
and then it is done. Which seems to be what happened...   Java looks like an
innocent bystander. 
 
If you can check this example with any other XSLT processor, I would expect
the same results.
 
A word of warning: this mailing list tends to be the territory of some
serious world class experts on Xalan, but a little grumpy about helping with
XSLT coding issues. If that is all this turns out to be, you probably want
to take further questions elsewhere. 
 
Larry  

  _____  

From: mgume...@gmail.com [mailto:mgume...@gmail.com] 
Sent: Wednesday, December 02, 2015 6:13 AM
To: xalan-j-us...@xml.apache.org
Subject: 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
<http://xslt.online-toolz.com/tools/xslt-transformation.php>  (AND
http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog
<http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatal
og> &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
  • Is this a bug? Максим Гумеров
    • RE: Is this a bug? Larry Trammell

Reply via email to