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

RE: using substring-functions more than once in a node

Subject: RE: using substring-functions more than once in a node
From: "Mario Michlits" <mario.michlits@xxxxxxxx>
Date: Thu, 28 Mar 2002 15:19:24 +0100
replace using substring
Hello

Thanx to David I can markup all my footnotes with the format (FN [1-9]) in my para-elements with an HTML anchor.
  
	<xsl:param name="replace" select="'(FN '"/>

	<xsl:template name="doFootnotes">
		<xsl:param name="string"/>
		<xsl:choose>
			<xsl:when test="contains($string, $replace)">
				<xsl:variable name="before">
					<xsl:value-of select="substring-before($string, $replace)"/>
				</xsl:variable>
				<xsl:variable name="number">
					<xsl:value-of select="substring(substring-after($string, $replace),1,1)"/>
				</xsl:variable>
				<xsl:variable name="after">
					<xsl:value-of select="substring(substring-after($string, $replace),2)"/>
				</xsl:variable>
				<xsl:value-of select="$before"/>
				<xsl:value-of select="$replace"/>
				<a>
				<xsl:attribute name="href">
					<xsl:text>#FN_</xsl:text>
					<xsl:value-of select="$number"/>
				</xsl:attribute>
				<xsl:value-of select="$number"/>
				</a>
				<xsl:call-template name="doFootnotes">
					<xsl:with-param name="string" select="$after"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$string"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="para">
		<xsl:call-template name="doFootnotes">
			<xsl:with-param name="string" select="."/>
		</xsl:call-template>
	</xsl:template>


Now I ve got an additional problem to solve. I am now trying to markup footnotes with more than just one format, firstly the (FN 1-9) Footnotes and secondly footnotes that look like this *) where the *symbol can repeat up to nine times: *********)
One way to solve this is to process the stylesheet more than once supplying another $replace parameter each time processing. E.g. in saxon: saxon source.xml replace.xsl replace=*****)
This is a procedure I would like to avoid. So does anyone know how I can use this named template more than once replacing each time another string? Thanx in advance, Mario

 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.