Subject: Re: [xsl] Add namespaces to a soap xml output From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 22 Sep 2006 11:49:39 +0100 |
> 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>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Add namespaces to a soap xml , Davide Antoni | Thread | Re: [xsl] Add namespaces to a soap , Davide Antoni |
[xsl] Add namespaces to a soap xml , Davide Antoni | Date | Re: [xsl] Add namespaces to a soap , Davide Antoni |
Month |