Re: PLEASE HELP: changing href attribute

Subject: Re: PLEASE HELP: changing href attribute
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 13 Jul 2000 14:38:24 GMT
> What is wrong?
Not the part you posted:-)
that was correct (but more complicated than you need, you don't need the
variables) but as you saw it did do the translation.
but you only posted the template for @href

I'd guess that your template for a looked like
<xsl:template match="a">
<xsl:copy>
<xsl:apply-templates select="@href"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

in which case you first make a a node, then you evaluate the template
for @href, but that just makes text not an attribute node, so you need
to put <xsl:attribute name="href">.....</xsl:attribute>
either inside the template body of your @href template, or
around the apply-templates call in you a template.

A simplification, without the variables, and without needing templates
for attribute nodes would be


<xsl:template match="a">
<a href="{substring-before(@href,'.xml')}.html">
 <xsl:copy-of select="@*[not(self::href)]"/>
 <xsl:apply-templates/>
</a>
</xsl:template>


David


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread