- From: <Wolfgang.Schreurs@ingbank.com>
- Date: Tue, 13 Aug 2002 12:26:43 -0400 (EDT)
- 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:
<portal_banner>
<spotlight_text>bla bla <a href="http://www.apple.com">apple</a>
bla</spotlight_text>
<spotlight_image</spotlight_image>
<spotlight_image_href></spotlight_image_href>
</portal_banner>
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)"/>
</xsl:template>
<!-- All sorts of markup for the final HTML file and stuff between and
after-->
<xsl:choose>
<xsl:when test="not(spotlight_text='')">
<tr>
<td>
<p>
<xsl:call-template name="substring_template"/>
</p>
</td>
</tr>
</xsl:when>
<xsl:when test="not(spotlight_image='')">
<tr>
<td>
<a href="{spotlight_image_href}"><img
src="{spotlight_image}" width="144" style="border:0px"/></a>
</td>
</tr>
</xsl:when>
</xsl:choose>
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