SV: [xsl] zap some node s and change attribute

Subject: SV: [xsl] zap some node s and change attribute
From: "Per Osnes" <per.osnes@xxxxxx>
Date: Wed, 18 Oct 2006 11:39:57 +0200
Hi Davide,
Try to replace the second template with something like: 

<xsl:template match="*[local-name() = 'RICHIESTA_INFORMAZIONI_ASSISTITO']">
  <RICHIESTA_INFORMAZIONI_ASSISTITO
xmlns="http://regione.campania.it/schemas/cup";>
    <xsl:copy-of select="@*[not(local-name() = 'idCup')]" />
    <xsl:attribute name="idCUP"><xsl:value-of select="@idCup"
/></xsl:attribute>
    <ASSISTITO>
      <xsl:for-each select="./*/*[normalize-space()]">
        <xsl:copy-of select="."/>
      </xsl:for-each>
    </ASSISTITO>
  </RICHIESTA_INFORMAZIONI_ASSISTITO>
</xsl:template>

That makes it more generic with respect to empty elements. 

 - Per Osnes.


-----Opprinnelig melding-----
Fra: Davide Antoni [mailto:davide.antoni@xxxxxxxxxxx] 
Sendt: 17. oktober 2006 19:37
Til: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Emne: Re: [xsl] zap some node s and change attribute

this work,

But if i want to take all the value of ASSISTITO how to?
If there are a blank node like this <CodSanitario/>
i want to delete it but if CodSanitario have a value i want to 
CodSanitario insteadof codFiscale.
I want if i have an input with valorizated tag, i want to display it, 
and if the tag have no value i want to zap from ASSISTITO.
MMMM
Sorry for my english



Mukul Gandhi ha scritto:
> Please try the following stylesheet:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>
> <xsl:output method="xml" indent="yes" />
>
> <xsl:template match="node() | @*">
>  <xsl:copy>
>    <xsl:apply-templates select="node() | @*" />
>  </xsl:copy>
> </xsl:template>
>
> <xsl:template match="*[local-name() = 
> 'RICHIESTA_INFORMAZIONI_ASSISTITO']">
>  <RICHIESTA_INFORMAZIONI_ASSISTITO
> xmlns="http://regione.campania.it/schemas/cup";>
>    <xsl:copy-of select="@*[not(local-name() = 'idCup')]" />
>    <xsl:attribute name="idCUP"><xsl:value-of select="@idCup" 
> /></xsl:attribute>
>    <ASSISTITO>
>      <CodFiscale><xsl:value-of select="*[local-name() =
> 'ASSISTITO']/*[local-name() = 'CodFiscale']" /></CodFiscale>
>    </ASSISTITO>
>  </RICHIESTA_INFORMAZIONI_ASSISTITO>
> </xsl:template>
>
> </xsl:stylesheet>
>
> I think above is probably the best way to solve this problem. But I
> would be happy to see any better code.

Current Thread