[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Split one line to multiple lines


Subject: [xsl] Split one line to multiple lines
From: "sudheshna iyer sudheshnaiyer@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 9 Oct 2014 19:59:00 -0000

I want to split the values in "Product" to multiple lines. For eg: for LineId = 222, there are 3 values (BBB;CCC;DDD;). So I need to create 3 lines along with the first line. How can I do that?
Eg: 
<ns1:Lines>
<ns1:Line>
<ns1:LineId>111</ns1:LineId>
<ns1:Product>AA</ns1:Product>
<ns1:Amount>100</ns1:Amount>
</ns1:Line>
<ns1:Line>
<ns1:LineId>222</ns1:LineId>
<ns1:Product>BBB;CCC;DDD;</ns1:Product>
<ns1:Amount>200</ns1:Amount>
</ns1:Line>
</ns1:Lines>

Output
<ns1:Lines>
<ns1:Line>
<ns1:LineId>111</ns1:LineId>
<ns1:Product>AAA</ns1:Product>
<ns1:Amount>100</ns1:Amount>
</ns1:Line>
<ns1:Line>
<ns1:LineId>222</ns1:LineId>
<ns1:Product>BBB</ns1:Product>
<ns1:Amount>100</ns1:Amount>
</ns1:Line>
<ns1:Line>
<ns1:LineId>222</ns1:LineId>
<ns1:Product>CCC</ns1:Product>
<ns1:Amount>100</ns1:Amount>
</ns1:Line>
<ns1:Line>
<ns1:LineId>222</ns1:LineId>
<ns1:Product>DDD</ns1:Product>
<ns1:Amount>100</ns1:Amount>
</ns1:Line>
</ns1:Lines>

I know there is a tokenize function. But how do I copy other values?

Thank you.


Current Thread