RE: [xsl] Translating element names

Subject: RE: [xsl] Translating element names
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Tue, 16 Jan 2001 22:43:35 -0000
> I am having trouble writing an XSLT to do a simple
> transformation task.  I have lots of XML documents
> that have there element tags as CAPITAL letters.  I
> need to write a XSLT to transform these XML documents
> to contain all lowercase elements.

You need something like

<xsl:template match="*">
  <xsl:element name="{translate(name(), 'ABCDEF...', 'abcdef...')}">
   <xsl:copy-of select="@*"/>
   <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

Possibly a bit more complex if using namespaces.

Mike Kay

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread