[xsl] Help renaming attributes

Subject: [xsl] Help renaming attributes
From: Nadia.Swaby@xxxxxx
Date: Thu, 06 Oct 2005 09:25:36 -0400
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