[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Rename Some Node and attribute


Subject: Re: [xsl] Rename Some Node and attribute
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Mon, 16 Oct 2006 16:46:44 +0100

But the OP wants to change the namespace as well doesn't he?

Joe


From: Abel Braaksma <abel.online@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Rename Some Node and attribute
Date: Mon, 16 Oct 2006 17:43:16 +0200

Davide Antoni wrote:

But how to rename the node : RICHIESTA_PRESTAZIONI_EROGABILI into :ELENCO_PRESTAZIONI


In much the same way, but the difference being that an attribute never has any children, but an element has. So in this case we have to re-apply the templates, like so (add this snippet to the previous one):


<xsl:template match="RICHIESTA_PRESTAZIONI_EROGABILI">
<xsl:element name="ELENCO_PRESTAZIONI ">
  <xsl:apply-templates />
</xsl:element>
</xsl:template>


The fun thing about XSLT matching rules is: you provide a general rule that applies to everything, and you provide special rules for special cases. XSLT will automatically select the special rules when they are encountered up the tree, and applies the generic rules when no special rule is found for a specific node.


Hope this helps,

Cheers,
-- Abel Braaksma
   http://www.nuntia.com


Current Thread
Keywords