This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
PLEASE HELP: changing href attribute
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: PLEASE HELP: changing href attribute
- From: "Meukens, Kris" <kris dot meukens at eds dot com>
- Date: Thu, 13 Jul 2000 14:06:51 +0100
- Reply-To: xsl-list at mulberrytech dot com
- Sensitivity: Company-Confidential
Hi,
I would like to change the value (.html instead of .xml) of the href
attribute in the following well-formed HTML:
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<a href="http://www.test.com/test.xml"
target="_blank">test.xml</a>
</BODY>
</HTML>
into:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<a href="http://www.test.com/test.hml"
target="_blank">test.xml</a>
</BODY>
</HTML>
I have already come up with:
<xsl:template match="@href">
<xsl:variable name="url">
<xsl:value-of select="."/>
</xsl:variable>
<xsl:variable name="name">
<xsl:value-of select="substring-before($url,
'.xml')"/>
</xsl:variable>
<xsl:variable name="htmlUrl">
<xsl:value-of select="concat($name, '.html')"/>
</xsl:variable>
href="<xsl:value-of select='$htmlUrl'/>"
</xsl:template>
But this results in:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<a>href="http://www.test.com/test.html" test.xml</a>
</BODY>
</HTML>
What is wrong?
Regards,
Kris.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list