xsl-list
[Top] [All Lists]

[xsl] Rename Some Node ans attribute

2006-10-16 06:39:55
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.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--