This will do it. Could be compressed but I think it should be easy to see the
process this way.
Terry Badger
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
B B B <xsl:template match="/">
B B B B B B B <xsl:result-document href="output.xml">
B B B B B B B B B B B <xsl:apply-templates/>
B B B B B B B </xsl:result-document>
B B B </xsl:template>
B B B <xsl:template match="Payments">
B B B B B B B <xsl:element name="Orders">
B B B B B B B B B B B <xsl:apply-templates/>
B B B B B B B </xsl:element>
B B B </xsl:template>
B B B <xsl:template match="Payment/invoiceDetails">
B B B B B B B <xsl:analyze-string select="." regex="([^;]*)(;)">
B B B B B B B B B B B <xsl:matching-substring>
B B B B B B B B B B B B B B B <xsl:element name="Order">
B B B B B B B B B B B B B B B B B B B <xsl:analyze-string select="."
regex="([^#]*)(#)([^;]*)">
B B B B B B B B B B B B B B B B B B B B B B B <xsl:matching-substring>
B B B B B B B B B B B B B B B B B B B B B B B B B B B <xsl:element
name="OrderNumber">
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B <xsl:value-of
select="regex-group(1)"/>
B B B B B B B B B B B B B B B B B B B B B B B B B B B
</xsl:element>B B B B B B B B B B B B B B B B B B B B B
B B B B B B B B B B B B B B B B B B B B B B B B B B B <xsl:element
name="Amount">
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B <xsl:value-of
select="regex-group(3)"/>
B B B B B B B B B B B B B B B B B B B B B B B B B B B </xsl:element>
B B B B B B B B B B B B B B B B B B B B B B B </xsl:matching-substring>
B B B B B B B B B B B B B B B B B B B </xsl:analyze-string>
B B B B B B B B B B B B B B B </xsl:element>
B B B B B B B B B B B </xsl:matching-substring>
B B B B B B B </xsl:analyze-string>
B B B </xsl:template>
</xsl:stylesheet>
On Tuesday, August 11, 2020, 7:34:48 AM EDT, Prady Prady prady.chin@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Team,
I need help with XSLT. Below is my requirement. Can somebody help?B
=====================
Input xml:
<Payments>
<Payment>
B B <invoiceDetails>order1#amt1;order2#amt2;</invoiceDetails>
</Payment>
</Payments>
I need to be able to convert this to:
Output xml:B
<Orders>
<Order>
B B <OrderNumber>order1</OrderNumber>
B B <Amount>amt1</Amount>
</Order>
<Order>
B B <OrderNumber>order2</OrderNumber>
B B <Amount>amt2</Amount>
</Order>
</Orders>======================
Thank you very much for yourB help
B B XSL-List info and archive
EasyUnsubscribe (by email)
|