We want to write XSLT transformation for given XML.
We are trying to text wrap for comment element at newline character on pressing of ENTER KEY. In that,
To minimize the problem to the main question here, consider the following stylesheet:
XSLT 2.0
???
Applied to the following input:
XML
000016
2016-04-19
ORD-411324
NIL
EDIORDER-SAVE COMMENTS\n C3 Generic\n LOC 0833\n Expected arrival 01/07/2016\n OTYPE NE\n TRKPC 01 GM/00007643020008361321
the result will be:
000016
2016-04-19
ORD-411324
NIL
EDIORDER-SAVE COMMENTS
???
NIL
C3 Generic
???
NIL
LOC 0833
???
NIL
Expected arrival 01/07/2016
???
NIL
OTYPE NE
???
NIL
TRKPC 01 GM/00007643020008361321
???
I have no idea where the contents of OrderLineID
are supposed to come from.
Important:
If the input Comment
contains actual linefeed characters - IOW, if your actual input is:
XML
000016
2016-04-19
ORD-411324
NIL
EDIORDER-SAVE COMMENTS
C3 Generic
LOC 0833
Expected arrival 01/07/2016
OTYPE NE
TRKPC 01 GM/00007643020008361321
then use:
Given the following input:
XML
000016
2016-04-19
ORD-411324
ABB-CDE-FGH-01
EDIORDER-SAVE COMMENTS
C3 Generic
LOC 0833
Expected arrival 01/07/2016
OTYPE NE
TRKPC 01 GM/00007643020008361321
OR-1561179
Nil
OR-1561180
Nil
OR-1561181
Nil
OR-1561182
Nil
OR-1561183
Nil
OR-1561184
the following stylesheet:
XSLT 2.0
will return:
Result
000016
2016-04-19
ORD-411324
ABB-CDE-FGH-01
EDIORDER-SAVE COMMENTS
OR-1561179
Nil
C3 Generic
OR-1561180
Nil
LOC 0833
OR-1561181
Nil
Expected arrival 01/07/2016
OR-1561182
Nil
OTYPE NE
OR-1561183
Nil
TRKPC 01 GM/00007643020008361321
OR-1561184