|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Quick way to change element names
> From: Woods, Christopher
> My first attempt was to try this:
>
> <xsl:for-each select="*"><xsl:element
> name="{concat('xhtml:',name())}"><xsl:apply-templates/></xsl:element>
>
This is not doing what you think its doing. A namespace prefix is not just
a string, and xmlns="blah" is not just another attribute. You are probably
doing some unnecessary work.
Check this to learn how to output elements with a namespace prefix:
http://www.dpawson.co.uk/xsl/sect2/N5536.html#d6476e1204
Read the rest of the page to learn how to handle your requirements in a more
graceful fashion. For example, declaring a default namespace for your
document would place all nodes in the document in that namespace.
If, having done some reading, you determine your original course is correct,
a variant of the identity template will accomplish it:
<xsl:template match="*">
<xsl:element name="local-name()" namespace="{$xhtml.namespace.uri}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
HTH,
-----------------------------------
Mike Haarman,
XSL Developer,
Internet Broadcasting Systems, Inc.
|
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








