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

RE: Help renaming attributes

Subject: RE: Help renaming attributes
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 6 Oct 2005 14:55:34 +0100
xslt renaming attributes
You want <xsl:attribute name="{expr}"> for a dynamically-specified name.
Note the curlies.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Nadia.Swaby@xxxxxx [mailto:Nadia.Swaby@xxxxxx] 
> Sent: 06 October 2005 14:26
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Help renaming attributes
> 
> Hi All,
> 
> I am trying to convert a structured Framemaker document to 
> and XML document
> that validates against our customized DTD.  When I convert a 
> Framemaker
> document to XML, any elements with id attributes look like this:
> 
> <figure Id="i494943"></figure>
> 
> I would like to change this (and all attributes) to lower case, for
> example:
> 
> <figure id="i494943"></figure>
> 
> I tried using this code (XSLT 2.0 with Saxon 8 .5):
> 
> <xsl:copy>
>       <xsl:for-each select="@*">
>             <xsl:attribute name="lower-case(name(.))">
>                   <xsl:value-of select="."/>
>             </xsl:attribute>
>       </xsl:for-each>
>       <xsl:apply-templates/>
> </xsl:copy>
> 
> and this
> 
> <xsl:copy>
>       <xsl:for-each select="@*">
>             <xsl:variable name="attrname" 
> select="lower-case(name(.))"/>
>             <xsl:attribute name="$attrname">
>                   <xsl:value-of select="."/>
>             </xsl:attribute>
>       </xsl:for-each>
>       <xsl:apply-templates/>
> </xsl:copy>
> But in both cases I get the error message "Attribute name is 
> not a valid
> QName".
> 
> Is there any way to work around this?
> 
> Thanks
> 
> Nadia

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.