|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] PLEASE HELP: changing href attribute
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








