Try something like
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="Payments">
<Orders><xsl:apply-templates/></Orders>
</xsl:template>
<xsl:template match="Payment">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="invoiceDetails">
<xsl:for-each select="tokenize(., ';')[position() lt last()]">
<xsl:variable name="data" select="."/>
<Order>
<OrderNumber><xsl:value-of
select="substring-before($data,'#')"/></OrderNumber>
<OrderAmount><xsl:value-of
select="substring-after($data,'#')"/></OrderAmount>
</Order>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Greetings
Leo
On 11 Aug 2020, at 13:34, Prady Prady prady(_dot_)chin(_at_)gmail(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Team,
I need help with XSLT. Below is my requirement. Can somebody help?
=====================
Input xml:
<Payments>
<Payment>
<invoiceDetails>order1#amt1;order2#amt2;</invoiceDetails>
</Payment>
</Payments>
I need to be able to convert this to:
Output xml:
<Orders>
<Order>
<OrderNumber>order1</OrderNumber>
<Amount>amt1</Amount>
</Order>
<Order>
<OrderNumber>order2</OrderNumber>
<Amount>amt2</Amount>
</Order>
</Orders>
======================
Thank you very much for your help
XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/945646> (by
email <>)
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--