Subject: Re: Rename Some Node ans attribute
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Mon, 16 Oct 2006 20:00:01 +0530
|
I think following should work.. (please wrap the below templates in
xsl:stylesheet)
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
<xsl:template match="@idCup">
<xsl:attribute name="idCUP"><xsl:value-of select="." /></xsl:attribute>
</xsl:template>
(this is not tested)
On 10/16/06, Davide Antoni <davide.antoni@xxxxxxxxxxx> wrote:
Hi to all
I need to change this xml:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://services.standardcup.esel.it">
<soapenv:Body>
<ser:RICHIESTA_PRESTAZIONI_EROGABILI DataOra="10102005" idCup="1"
idOperatore="1"/>
</soapenv:Body>
</soapenv:Envelope>
into this:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://regione.campania.it/schemas/cup">
<soapenv:Body>
<ser:ELENCO_PRESTAZIONI DataOra="?" idCUP="?" idOperatore="?">
<ser:PRESTAZIONE/>
</ser:ELENCO_PRESTAZIONI>
</soapenv:Body>
</soapenv:Envelope>
Pay attention on idCup that must be idCUP on the trasformation: i have
this fot do it:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://services.standardcup.esel.it"
xmlns:cup="http://services.standardcup.esel.it">
<xsl:strip-space elements="*"/>
<xsl:output indent="yes"/>
<!--
most stuff you want to copy:
-->
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*[name()!='idCup']"/>
<xsl:if test="@idCup">
<xsl:attribute name="idCUP">
<xsl:value-of select="@idCup">
</xsl:value-of>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Many thanks.
--
Regards,
Mukul Gandhi
|