|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Changing 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








