|
Subject: RE: [xsl] Quick way to change element names From: "Haarman, Michael" <mhaarman@xxxxxxxxx> Date: Thu, 19 Jan 2006 17:05:09 -0600 |
> 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.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Quick way to change eleme, David Carlisle | Thread | [xsl] Re: Digest Issue 664 - How to, cavecatem@xxxxxxxxxx |
| Re: [xsl] Quick way to change eleme, David Carlisle | Date | [xsl] Re: Digest Issue 664 - How to, cavecatem@xxxxxxxxxx |
| Month |