RE: [xsl] Rename Some Node ans attribute

Subject: RE: [xsl] Rename Some Node ans attribute
From: cknell@xxxxxxxxxx
Date: Mon, 16 Oct 2006 10:23:45 -0400
You haven't told us exactly how the transformation fails, but I suspect that namespaces are at the root of it.

What namespace(s) is/are the attributes DataOra and idCup in?

Since both of these have no namespace prefix (like "soapenv:" and "ser:"), they must be in the default namespace, which you haven't shown us.

Unless that default namespace is declared and named  in your stylesheet and unless the attributes are identified in your stylesheet with the declared namespace , these attributes will be "invisible" to the the transformation.
--
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Davide Antoni <davide.antoni@xxxxxxxxxxx>
Sent:     Mon, 16 Oct 2006 15:39:27 +0200
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  [xsl] Rename Some Node ans attribute

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.

Current Thread