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

Re: String manipulation in Xslt 1.0

Subject: Re: String manipulation in Xslt 1.0
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 27 Aug 2020 08:03:55 -0000
Re:  String manipulation in Xslt 1.0
ends-with() is an XPath 2.0 function, not available in 1.0.

Michael Kay
Saxonica

> On 27 Aug 2020, at 06:21, Leo Studer leo.studer@xxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> This does it ;-)
>
> <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform
<http://www.w3.org/1999/XSL/Transform>">
>     <xsl:output indent="yes"/>
>
>     <xsl:template match="Payments">
>         <Payments>
>             <xsl:apply-templates/>
>         </Payments>
>     </xsl:template>
>
>     <xsl:template match="Payment">
>         <Payment>
>             <invoiceDetails>
>                 <xsl:apply-templates/>
>             </invoiceDetails>
>         </Payment>
>     </xsl:template>
>
>     <xsl:template match="invoiceDetails">
>         <xsl:param name="details">
>             <xsl:if test="ends-with(.,';')"><xsl:value-of
select="."/></xsl:if>
>             <xsl:if test="not(ends-with(.,';'))"><xsl:value-of
select="concat(.,';')"/></xsl:if>
>         </xsl:param>
>         <xsl:variable name="first"
select="substring-before($details,';')"/>
>         <xsl:variable name="others"
select="substring-after($details,';')"/>
>            <xsl:value-of
select="concat(substring-before($first,'#'),';')"/>
>         <xsl:if test="contains($others,'#')">
>             <xsl:apply-templates select=".">
>                 <xsl:with-param name="details" select="$others"/>
>             </xsl:apply-templates>
>         </xsl:if>
>     </xsl:template>
>
> </xsl:stylesheet>
>
>
> Cheers
> Leo
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/293509> (by
email <>)

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.