[INT-3067] xslt-transformer should return correct 'text' result for <xsl:output method="text"> Created: 15/Jun/13  Updated: 05/Sep/13  Resolved: 17/Aug/13

Status: Closed
Project: Spring Integration
Component/s: XML
Affects Version/s: 2.2.4
Fix Version/s: 3.0 M3

Type: Improvement Priority: Minor
Reporter: Farhan Hussain Assignee: Artem Bilan
Resolution: Complete Votes: 1
Labels: PullRequest
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File SMTP216DWC10_20130430_180857P.txt     XML File integration-config.xml     XML File test-transformer.xsl     XML File test.xml    
Issue Links:
depends on INT-1838 Allow xslt-transformer to create text... Closed


The following xslt-transformer configuration:

<int-xml:xslt-transformer id="itemTransformer"
	    input-channel="inputChannel" output-channel="outputChannel"
	    xsl-resource="file:/test-transformer.xsl" result-transformer="resultToString">

Does not seem to accept <xsl:output method="text"/>. The result of this transformation is the following line in the output:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

If the output type is changed to xml or html things seem to work fine. The xsl and the xml are attached.

This is the same issue as INT-1838 which should have been resolved in 2.0.4.

Comment by Artem Bilan [ 17/Jun/13 ]

Hi, Farhan!

How about to follow with Jonas Partner recomendation from INT-1838: add result-type="StringResult" to your <int-xml:xslt-transformer>?

Comment by Artem Bilan [ 17/Jun/13 ]

I've just tested it with your samples and even without result-type="StringResult".
And here is a result:

Handsome, white furred poodle with affectionate disposition.

Famous, talking mouse, married to Minnie.

Micky's adorable companion.

This bird has brilliant green and red plumage. She talks, but her language is often coarse and foul. Very suitable pet for an aspiring pirate.

Dressed in the usual black and white penguin outfit. This very clever bird can operate a computer and make it run faster, more reliably, and less expensively than you would believe. Donated to the shop by Torvalds and Associates. We are allowed to clone this bird, modify it, and distribute as many copies as we wish. Buyers of this bird may also clone it, modify it, and distribute as many copies as they wish.

Smooth green scales, friendly disposition.

So, where is an issue?

Comment by Farhan Hussain [ 17/Jun/13 ]

Hi Artem,

I appreciate the prompt response. I am unfortunately not seeing this. I am attaching my config here and the output file that is generated. Perhaps there is an issue elsewhere in my configuration?

Comment by Farhan Hussain [ 17/Jun/13 ]

The test output I am seeing.

Comment by Farhan Hussain [ 17/Jun/13 ]

Spring Integration Configuration

Comment by Artem Bilan [ 17/Jun/13 ]

So, I got it:
You send to the <int-xml:xslt-transformer> File payload, and it really ends up with <?xml version="1.0" encoding="UTF-8" standalone="no"?>, if you don't provide an attribute
Try it now!
Jonas Partner was right
BTW, there is no guaranty which content has a file, so XsltPayloadTransformer creates DOMResult for it by default. But your xslt doesn't provide DOM - it's just 'text'.
Good luck and let us know about closing the issue.

Comment by Farhan Hussain [ 17/Jun/13 ]

Hi Artem,
Thanks for checking this, and yes you are correct. That works. Appreciate the help.

Comment by Artem Bilan [ 17/Jun/13 ]

I assume it should be documented, at least.
So, will be converted to Doc task and address it in the nearest release.

Comment by Artem Bilan [ 18/Jun/13 ]

Guys, sorry.
I looked at this one more time and it seemed like XsltPayloadTransformer should force to StringResult in case XSLT output method="text". Especially, since we have access to this:


Of course, the coercion has to be applied only if resultFactory isn't provided.
And there won't be need to always add result-type="StringResult" attribute.
So, I'm going to convert this issue to the Improvement and PR soon.

Comment by Artem Bilan [ 18/Jun/13 ]

PR: https://github.com/SpringSource/spring-integration/pull/828

Comment by Gunnar Hillert [ 17/Aug/13 ]

Merged PR.

Generated at Sat Jul 11 05:55:26 UTC 2020 using Jira 8.5.4#805004-sha1:0444eab799707f9ad7b248d69f858774aadfd250.