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

RE: Copy attributes? ... possible problem in FAQ

Subject: RE: Copy attributes? ... possible problem in FAQ
From: Nick Vincent <Nick@xxxxxxxxxxxx>
Date: Fri, 9 Mar 2001 15:30:31 -0000
copy attributes
My bad.  I've worked it out now.

Looks like there might still be a problem in the FAQ though.  I think it
should be of the form:

<xsl:template match="mytag">
	<mynewtagname>
		<xsl:for-each select="*@">
			<xsl:attribute name="{name()}"><xsl:value-of
select="." /></xsl:attribute>
		</xsl:for-each>
 		<!-- Deal with content -->
	</mynewtagname>
</xsl:template>

with additional curly braces in the <xsl:attribute> element.

Thanks,

Nick Vincent
NeoWorks

> -----Original Message-----
> From: Nick Vincent 
> Sent: 09 March 2001 15:26
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: Copy attributes? ... possible problem in FAQ
> 
> 
> Hi all,
> 
> I'm trying to change a tag name and copy all of it's 
> attributes.  The suggested way of doing this in the copy FAQ 
> at www.dpawson.co.uk is this:
> 
> <xsl:template match="mytag">
> 	<mynewtagname>
> 		<xsl:for-each select="*@">
> 			<xsl:attribute 
> name="name()"><xsl:value-of select="." /></xsl:attribute>
> 		</xsl:for-each>
> 		<!-- Deal with content -->
> 	</mynewtagname>
> </xsl:template>
> 
> However, in <xsl:attribute name="" /> the name parameter is 
> of type 'qname', which is not calculated at runtime, hence 
> the actual output is:
> 
> <mynewtagname name()="value">
> 	...
> </mynewtagname>
> 
> Is there any other way of doing this?
> 
> Thanks,
> 
> 
> Nick Vincent
> NeoWorks
> 

 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.