Y at-il moyen d'éviter de remplir l'espace de noms de common: prefix dans la sortie? Et cet espace de noms doit remplacer en tant qu'espace de noms par défaut. J'ai ce fichier exemple:Besoin de supprimer l'espace de noms de préfixe dans la sortie à l'aide de XSLT
ENTRÉE:
<IntraConsignment xmlns="http://www.minfin.fgov.be/IntraConsignment" xmlns:common="http://www.minfin.fgov.be/InputCommon" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.minfin.fgov.be/IntraConsignment NewICO-in_v0_7.xsd" IntraListingsNbr="1">
<Representative>
<common:RepresentativeID identificationType="NVAT" issuedBy="BE">9876941603</common:RepresentativeID>
</Representative>
<IntraListing SequenceNumber="1" ClientsNbr="1" AmountSum="1000.00">
<Declarant>
<common:VATNumber>9876941603</common:VATNumber>
</Declarant>
<Period>
<Month>07</Month>
</Period>
<IntraClient SequenceNumber="1">
<CompanyVATNumber issuedBy="DE">123456</CompanyVATNumber>
</IntraClient>
</IntraListing>
</IntraConsignment>
Et, je dois retirer le commun: préfixe dans le code XML et les éléments qui ne disposent pas d'un préfixe doit avoir un NS2: préfixe.
Je possède ce stylesheet:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.minfin.fgov.be/IntraConsignment" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:common="http://www.minfin.fgov.be/InputCommon" xmlns="http://www.minfin.fgov.be/InputCommon" exclude-result-prefixes="xs xsi xsl common">
<xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="common:*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="*">
<xsl:element name="ns2:{local-name()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Mon xslt est tout à fait un travail, mais l'espace de noms xmlns = "http://www.minfin.fgov.be/InputCommon" ne sont pas apparus dans la sortie.
SORTIE GÉNÉRÉ:
<ns2:IntraConsignment xmlns:ns2="http://www.minfin.fgov.be/IntraConsignment" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.minfin.fgov.be/IntraConsignment NewICO-in_v0_7.xsd" IntraListingsNbr="1">
<ns2:Representative>
<RepresentativeID xmlns="http://www.minfin.fgov.be/InputCommon" identificationType="NVAT" issuedBy="BE">9876941603</RepresentativeID>
</ns2:Representative>
<ns2:IntraListing SequenceNumber="1" ClientsNbr="1" AmountSum="1000.00">
<ns2:Declarant>
<VATNumber xmlns="http://www.minfin.fgov.be/InputCommon">9876941603</VATNumber>
</ns2:Declarant>
<ns2:Period>
<ns2:Month>07</ns2:Month>
</ns2:Period>
<ns2:IntraClient SequenceNumber="1">
<ns2:CompanyVATNumber issuedBy="DE">123456</ns2:CompanyVATNumber>
<ns2:Amount>1000.00</ns2:Amount>
</ns2:IntraClient>
</ns2:IntraListing>
</ns2:IntraConsignment>
ATTENDUS:
<ns2:IntraConsignment xmlns:ns2="http://www.minfin.fgov.be/InputCommon" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.minfin.fgov.be/IntraConsignment NewICO-in_v0_7.xsd" xmlns="http://www.minfin.fgov.be/InputCommon" IntraListingsNbr="1">
<ns2:Representative>
<RepresentativeID identificationType="NVAT" issuedBy="BE">9876941603</RepresentativeID>
</ns2:Representative>
<ns2:IntraListing SequenceNumber="1" ClientsNbr="1" AmountSum="1000.00">
<ns2:Declarant>
<VATNumber>9876941603</VATNumber>
</ns2:Declarant>
<ns2:Period>
<ns2:Month>07</ns2:Month>
</ns2:Period>
<ns2:IntraClient SequenceNumber="1">
<ns2:CompanyVATNumber issuedBy="DE">123456</ns2:CompanyVATNumber>
<ns2:Amount>1000.00</ns2:Amount>
</ns2:IntraClient>
</ns2:IntraListing>
</ns2:IntraConsignment>