W3C home > Mailing lists > Public > www-xsl-fo@w3.org > August 2002

Using substring and gaining a <a href="...">...<a> from within

From: <Wolfgang.Schreurs@ingbank.com>
Date: Tue, 13 Aug 2002 12:26:43 -0400 (EDT)
Message-ID: <116134D21B7CD411BE0F00508B69D57A033CDF0C@AMSXCH06>
To: www-xsl-fo@w3.org

I hope someone can help me with this...

I've got 2 files, 1 XML/1 XSL. Both files are used for creating a HTML file.
The XML file looks like this:

	<spotlight_text>bla bla <a href="http://www.apple.com">apple</a>

Within the XSL file I want to take the line 'spotlight_text' and break it up
in a text part and a hyperlink.
The text part should contain: 'bla bla apple bla'.

I want 'apple' to be a hyperlink to (in this case) the apple website. This
should be generated within the XSL file. I also want the total text input to
be limited to for example 60 chars.
At the moment I got this in my XSL file:

<xsl:template name="substring_template">
	<xsl:variable name="right_text_string" select="spotlight_text"/>
	<xsl:value-of select="substring($right_text_string,0, 60)"/>

<!-- All sorts of markup for the final HTML file  and stuff between and

	<xsl:when test="not(spotlight_text='')">
		<xsl:call-template name="substring_template"/>

	<xsl:when test="not(spotlight_image='')">
		<a href="{spotlight_image_href}"><img
src="{spotlight_image}" width="144" style="border:0px"/></a>

The problem is that substring() removes the '<a href="...">...</a>' tag, but
as far as I know I have to use substring to count the chars. After these
files are processed (by Xalan), everything I get is this:
'bla bla apple bla' without the hyperlink on apple.

Does someone have a solution to get this working?
Received on Tuesday, 13 August 2002 12:51:02 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:26 UTC