Support #3539
closedTemplate rule is not streamable
0%
Description
I Have a input XML hierarchy like this:
Here Sender and Summary occurs once and Persons is a repeating node. I want to produce similar output XML (by applying some xslt rules).
For-each is applied on Persons node : <xsl:for-each select="LendingDataMessage/Persons ! copy-of(.)">
Every time i run the XSLT in streaming mode , it gives me error : Template rule is not streamable * There is more than one consuming operand.
If i remove Sender and Summary nodes then it works fine . Could you please help me out how to achieve the correct output.
Sample XSL and input XML is attached.
Files
Updated by Michael Kay about 7 years ago
- File sample2.xsl sample2.xsl added
I attach sample2.xsl which shows how your code can be made streamable by splitting it into template rules.
The reason this works is fairly subtle. In your code, the sequential logic means that Sender, Summary, and Persons are always produced in that order, regardless what order they appear in the input. The XSLT compiler doesn't know what order they appear in the input, so it has to assume the worst, which means that the output order might not be the same as the input order, and that makes the code non-streamable. By rewriting it using template rules, my revised version outputs Sender, Summary, and Persons in whatever order they appear in the input (they might always be in that order, but the code will still work if they aren't). So the code isn't doing any re-ordering, and is therefore streamable.
Updated by Michael Kay about 7 years ago
- Tracker changed from Bug to Support
- Status changed from New to In Progress
Updated by Michael Kay almost 7 years ago
- Category set to Streaming
- Status changed from In Progress to Closed
- Assignee set to Michael Kay
Please register to edit this issue