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

using substring-functions more than once in a node?

Subject: using substring-functions more than once in a node?
From: "Mario Michlits" <mario.michlits@xxxxxxxx>
Date: Tue, 26 Mar 2002 19:00:21 +0100
using substring
Hello

I m experimenting with substring functions to markup footnote references in my text.
For example I got following element:

<para>This is my first sentence (FN 1). And this is the last one (FN 2).</para>

What I want is to markup the footnote's numbers as HTML <a>-elements. A footnote always has this format: (FN [1-9])
This is done by the following code:

<xsl:variable name="var1">
	<!-- extracts text after the first FN beginning with the number -->
	<xsl:value-of select="substring-after(para, '(FN ')"/>
</xsl:variable>

	<xsl:variable name="var2">
		
					<!-- provides the text before the footnote -->
					<xsl:value-of select="substring-before(para, '(FN ')"/>
					<!-- puts the footnote together creating the anchor-element -->
					<xsl:text>(FN </xsl:text>
					<a>
						<xsl:attribute name="href"><xsl:text>#FN_target_</xsl:text><xsl:value-of select="substring($var1, 1, 1)"/></xsl:attribute>
						<xsl:value-of select="substring($var1, 1, 1)"/>
					</a>
					<!-- provides the part behind the footnote -->
					<xsl:value-of select="substring-after(para, '(FN 1')"/>
					<xsl:value-of select="substring-after(para, '(FN 2')"/>
					<xsl:value-of select="substring-after(para, '(FN 3')"/>
					<xsl:value-of select="substring-after(para, '(FN 4')"/>
					<xsl:value-of select="substring-after(para, '(FN 5')"/>
					<xsl:value-of select="substring-after(para, '(FN 6')"/>
					<xsl:value-of select="substring-after(para, '(FN 7')"/>
					<xsl:value-of select="substring-after(para, '(FN 8')"/>
					<xsl:value-of select="substring-after(para, '(FN 9')"/>
					<br/>
		
	</xsl:variable>

The output of the above example would be:
This is my first sentence (FN <a href ="#FN_target_1">1</a>). And this is the last one (FN 2)).

The problem is, that this only works if there is just one footnote in my text, but doesn't work if there are more. So my question is, if anyone knows if and how I can use
the substring-functions to match more than once in a node in order to markup all my footnotes.
Any help will be appreciated:-)

regards
Mario M.


 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.