I need to change a namaspaces because i need to post this xml in a
webservices that recognize only with e namespaces and nillable tag.
Now your xsl zap the empty tag but no namespaces insert, now my output
is with your sylesheets:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<RICHIESTA_INFORMAZIONI_ASSISTITO xmlns="some.url"
DataOra="200603072355" idCup="150103" idOperatore="df">
<ASSISTITO>
<CodFiscale>CRDLCN73L04F839J</CodFiscale>
</ASSISTITO>
</RICHIESTA_INFORMAZIONI_ASSISTITO>
</soapenv:Body>
</soapenv:Envelope>
David Carlisle ha scritto:
I need to add one namespaces to all node and remove all tag that not
contains any data from a soap envolpe request :
It seems that you don't want to add a namespace, just change the prefix
for the namespace from the default (no prefix) to cup:
Which is slightly odd as it makes no difference to any namespace aware
system which prefix is used, but anyway, something like this:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cup="some.url">
<xsl:strip-space elements="*"/>
<xsl:output indent="yes"/>
<!--
most stuff you want to copy:
-->
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!--
stuff in cup namespace you want to prefix (why?)
-->
<xsl:template match="cup:*">
<xsl:element name="cup:{local-name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<!--
zap empty stuff
-->
<xsl:template match="*[not(node())]" priority="2"/>
</xsl:stylesheet>
$ saxon cup.xml cup.xsl
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<cup:RICHIESTA_INFORMAZIONI_ASSISTITO xmlns:cup="some.url" DataOra="200603072355"
idCup="150103" idOperatore="df">
<cup:ASSISTITO>
<cup:CodFiscale>CRDLCN73L04F839J</cup:CodFiscale>
</cup:ASSISTITO>
</cup:RICHIESTA_INFORMAZIONI_ASSISTITO>
</soapenv:Body>
</soapenv:Envelope>
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--