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

RE: How might I reproduce a tag, but change one attri

Subject: RE: How might I reproduce a tag, but change one attribute?
From: footh <footh@xxxxxxxxx>
Date: Fri, 27 Jan 2006 10:28:52 -0800 (PST)
xsl change one copy of
Mike,

Thanks a ton, this is exactly what I was looking for.

Regards,

JF

--- "Haarman, Michael" <mhaarman@xxxxxxxxx> wrote:

> > From: footh
> > an <img> tag exactly, except I want to change one
> > attribute, the "src".  The only way I can think of
> 
> 
>   <xsl:template match="img">
>     <xsl:copy>
>       <xsl:copy-of select="@*"/>
>       <xsl:attribute name="src">
>         <xsl:value-of select="'bar'"/>
>       </xsl:attribute>
>       <xsl:apply-templates/>
>     </xsl:copy>
>   </xsl:template>
> 
> This is a modified identity template.  The copy-of
> instruction selects all
> attributes of the element and copies them and their
> values.  Just after it,
> the attribute instruction names and values a new
> @src attribute which
> overrides the value for @src just copied in the
> previous instruction.
> apply-templates catches any child nodes of the img
> element, unnecessary if
> you know img is always a leaf node.
> 
> HTH,
> 
> 
> -----------------------------------
> Mike Haarman,
> XSL Developer,
> Internet Broadcasting Systems, Inc.
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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.