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

Re: Translating element names

Subject: Re: Translating element names
From: "Steve Muench" <Steve.Muench@xxxxxxxxxx>
Date: Tue, 16 Jan 2001 09:50:21 -0800
talented identity transformation
This is a task for the Talented Identity Transform,
the stylesheet that transform a document to itself.

By augmenting the identity transformation:

<!-- The Identity Transformation -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!-- Whenever you match any node or any attribute -->
  <xsl:template match="node()|@*">
    <!-- Copy the current node -->
    <xsl:copy>
      <!-- Including any attributes it has and any child nodes -->
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>


with an <xsl:template> that effects elements in
the way that you want, all will be well.

You'll end up with something like this:

<!-- Transform a document to itself, lowercasing all tag names -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!-- Import the identity transformation -->
  <xsl:import href="identity.xsl"/>
  <!-- When you match any element -->
  <xsl:template match="*">
    <!-- Create the same element with a lowercase name -->
    <xsl:element name="{translate(name(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                                         'abcdefghijklmnopqrstuvwxyz')}">
      <!-- Including any attributes it has and any child nodes -->
      <xsl:apply-templates select="@*|node()"/>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>


______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly
http://www.oreilly.com/catalog/orxmlapp/

----- Original Message ----- 
From: "Thropp Lori" <lmt727@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, January 16, 2001 9:16 AM
Subject:  Translating element names


| 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.  It should be
| relatively easy but I am having problems. I am still
| new to writing XSLT and I am having trouble.  Could
| someone lend a hand or point me in the right
| direction.
| 
| Thank you.
| 
| __________________________________________________
| Do You Yahoo!?
| Get email at your own domain with Yahoo! Mail. 
| http://personal.mail.yahoo.com/
| 
|  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| 
| 


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


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.