|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Help 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








