[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Need help with tokenize functionality in XSLT 1.0

Subject: Re: Need help with tokenize functionality in XSLT 1.0
From: "Prady Prady prady.chin@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 25 Aug 2020 20:41:11 -0000
Re:  Need help with tokenize functionality in XSLT 1.0
This works good. Thanks for the solution.


But this is not working if there is only one order

eg:
=====================
Input xml:

<Payments>

<Payment>

<invoiceDetails>order1#amt1</invoiceDetails>

</Payment>

</Payments>

I need to be able to convert this to:
Output xml:

<Orders>

<Order>

<OrderNumber>order1</OrderNumber>

<Amount>amt1</Amount>

</Order>

</Orders>
======================

On Thu, 20 Aug 2020 at 12:52, Leo Studer leo.studer@xxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Nice, a recursive template with a parameter ;-)
>
> Cheers
> Leo
>
>
> >
> > <xsl:template match="Payment">
> >  <xsl:param name="details" select="invoiceDetails"/>
> >  <xsl:variable name="car" select="substring-before($details,';')"/>
> >  <xsl:variable name="cdr" select="substring-after($details,';')"/>
> >  <Order>
> >   <OrderNumber><xsl:value-of
> select="substring-before($car,'#')"/></OrderNumber>
> >   <Ammount><xsl:value-of select="substring-after($car,'#')"/></Ammount>
> >  </Order>
> >  <xsl:if test="contains($cdr,'#')">
> >   <xsl:apply-templates select=".">
> >    <xsl:with-param name="details" select="$cdr"/>
> >   </xsl:apply-templates>
> >  </xsl:if>
> > </xsl:template>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.