[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
changing href text
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.