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

Quick way to change element names

Subject: Quick way to change element names
From: "Woods, Christopher" <cwoods@xxxxxxxxxxxxxxxxx>
Date: Thu, 19 Jan 2006 16:25:01 -0500
change element name
I have a batch of documents that began life as plain old HTML and
converted them to XML using James Clark's SX utility.  Now I need to
change all the tags in each file from the current format that looks like
this:

<p>blah blah blah</p>  to something that looks like this:

<xhtml:p>blah blah blah</xhtml:p>

My first attempt was to try this:

<xsl:for-each select="*"><xsl:element
name="{concat('xhtml:',name())}"><xsl:apply-templates/></xsl:element>

The above is simplified as there are attributes and the like in the mix
but it worked fairly except in circumstances where things are nested
more than two layers deep.  I'm looking for a quick way to change the
tags from <myTag/> to <xhtml:myTag/> using XSL.  I suppose this could be
accomplished through some sort of find/replace macro but I'd prefer to
run a transform on the whole batch and have done with it.  Any
suggestions?

TIA,

Chris

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.