This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

using substring-functions more than once in a node?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]