[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Need help with XSLT tokenize
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 <>)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|