|
Subject: PLEASE HELP: changing href attribute From: "Meukens, Kris" <kris.meukens@xxxxxxx> Date: Thu, 13 Jul 2000 14:06:51 +0100 |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: Flattening a tree, Pierre-Yves Saumont | Thread | Re: PLEASE HELP: changing href attr, Juergen Hermann |
| Flattening a tree, Pierre-Yves Saumont | Date | Re: deal with a string in XSL, Jean de Lavarene |
| Month |