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

RE: Extracting string...

Subject: RE: Extracting string...
From: "Paul Brown" <prb@xxxxxxxxxxxxx>
Date: Fri, 12 Jan 2001 14:47:29 -0600
extracting string
The answer is recursion:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template name="substring-after-last">
	<xsl:param name="input" />
	<xsl:param name="marker" />

	<xsl:choose>
		<xsl:when test="contains($input,$marker)">
			<xsl:call-template name="substring-after-last">
				<xsl:with-param name="input" select="substring-after($input,$marker)" />
				<xsl:with-param name="marker" select="$marker" />
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="$input" />
		</xsl:otherwise>
	</xsl:choose>

</xsl:template>

<xsl:template match="FOO"><xsl:call-template name="substring-after-last">
	<xsl:with-param name="input" select="'1.2.3.4.5.6.7'" />
	<xsl:with-param name="marker" select="'.'" />
</xsl:call-template></xsl:template>

</xsl:stylesheet>

	- Paul

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> blackrock@xxxxxxx
> Sent: Friday, January 12, 2001 10:18 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Extracting string...
>
>
> Dear people,
>
> I read about the substring-after()-function, which can extract a substring
> after the FIRST occurance of a specified string.
>
> My problem: Have you got an idea, how I can get the substring-after of a
> string after the LAST occurance of a specified substring??
>
> For example: I want the substring after the last ".".
>
> String: "A.B.C.0.1.1.hgk"
>
> The solution should return: "hgk"
>
> Any advice is greatly appreciated.
>
>
> Thanks in advance.
>
> Yunus Karakaya
>
>
> --
> Sent through GMX FreeMail - http://www.gmx.net
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.