xsl-list
[Top] [All Lists]

RE: Help renaming attributes

2005-10-06 06:55:34
You want <xsl:attribute name="{expr}"> for a dynamically-specified name.
Note the curlies.

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

-----Original Message-----
From: Nadia(_dot_)Swaby(_at_)pwc(_dot_)ca 
[mailto:Nadia(_dot_)Swaby(_at_)pwc(_dot_)ca] 
Sent: 06 October 2005 14:26
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>