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

Re: Changing tag text

Subject: Re: Changing tag text
From: Gary Hegenbart <ghegenbart@xxxxxxxxx>
Date: Wed, 27 Oct 2004 12:16:46 -0700
tag text
Hank,
If you want to use a : in the tag name, be sure to include a namespace
declaration in the output XML.  Or use a different character, which is
what I did in the example below.  It seemed to work in my test,
someone else may have another (better?) way of doing it.

<xsl:template match="/">
 		<xsl:call-template name="chName" />	
</xsl:template>

<xsl:template name="chName">
	<xsl:for-each select="child::node()">
	<xsl:choose>
		<xsl:when test="not(self::*)">
			<xsl:value-of select="." />
		</xsl:when>
		<xsl:when test="self::*">
 			<xsl:variable name="elname" select="concat('xsl_', name())" />
	 		<xsl:element name="{$elname}"> 
				<xsl:call-template name="chName" />
			</xsl:element>
		</xsl:when>
	</xsl:choose>
	</xsl:for-each> 
</xsl:template>

Let me know how it works 
-- 
Gary Hegenbart

On Tue, 26 Oct 2004 15:58:58 -0500, Hank Hepler <hankhepler@xxxxxxxxx> wrote:
> Hello all,
> I need some guidance on how to go about changing a tag name in a
> transform from one XML file to another XML file, or actually appending
> something on the tag name like so:
> <Atag>some data</Atag>
> to
> <xsl:Atag>somedata</xsl:Atag>
> 
> I need it to add the "xsl:" to each tag. Seems like it would be a
> simple answer but just not seeing it right now and any help will be
> greatly appreciated!
> 
> Thanks,
> Hank

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.