Subject: Re: [xsl] Need help with XSLT tokenize From: "Prady Prady prady.chin@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 12 Aug 2020 10:42:15 -0000 |
Thank you, Mukul Gandhi. On Tue, 11 Aug 2020 at 23:30, Mukul Gandhi gandhi.mukul@xxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > On Tue, Aug 11, 2020 at 5:59 PM Leo Studer leo.studer@xxxxxxxxxxx < > xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > >> 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> >> > > I was wanting to write a solution, for this usecase. But above solution > made me feel that, its elegant and correct (based on visual inspection of > the code). > > But it seems that, Dimitre has taken the solution to this usecase to new > level. > > > > -- > Regards, > Mukul Gandhi > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3397216> (by > email <>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Need help with XSLT token, Mukul Gandhi gandhi. | Thread | Re: [xsl] Need help with XSLT token, Leo Studer leo.stude |
Re: [xsl] Need help with XSLT token, Mukul Gandhi gandhi. | Date | Re: [xsl] Need help with XSLT token, Leo Studer leo.stude |
Month |