Subject: Re: [xsl] Need help with XSLT tokenize From: "Prady Prady prady.chin@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 11 Aug 2020 22:29:10 -0000 |
Terry/Leo, Thank you very much for your response. Will put this in and try it out. On Tue, 11 Aug 2020 at 13:35, Terry Badger terry_badger@xxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > 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"> > <xsl:template match="/"> > <xsl:result-document href="output.xml"> > <xsl:apply-templates/> > </xsl:result-document> > </xsl:template> > <xsl:template match="Payments"> > <xsl:element name="Orders"> > <xsl:apply-templates/> > </xsl:element> > </xsl:template> > <xsl:template match="Payment/invoiceDetails"> > <xsl:analyze-string select="." regex="([^;]*)(;)"> > <xsl:matching-substring> > <xsl:element name="Order"> > <xsl:analyze-string select="." > regex="([^#]*)(#)([^;]*)"> > <xsl:matching-substring> > <xsl:element name="OrderNumber"> > <xsl:value-of select="regex-group(1)"/> > </xsl:element> > <xsl:element name="Amount"> > <xsl:value-of select="regex-group(3)"/> > </xsl:element> > </xsl:matching-substring> > </xsl:analyze-string> > </xsl:element> > </xsl:matching-substring> > </xsl:analyze-string> > </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? > ===================== > 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 > EasyUnsubscribe (by email)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Need help with XSLT token, Terry Badger terry_b | Thread | Re: [xsl] Need help with XSLT token, Dimitre Novatchev dn |
Re: [xsl] Need help with XSLT token, Dimitre Novatchev dn | Date | Re: [xsl] Need help with XSLT token, Mukul Gandhi gandhi. |
Month |