У меня есть XML, как показано ниже, и вы хотите удалить из запроса SOAP-конверт и тело и сгенерировать, как показано ниже.Удалить xmlns из XML с помощью XSLT
Текущий XML
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AsnPODetailsRequest>
<AsnPODetails>
<RequestSourcedFrom>EDI</RequestSourcedFrom>
<ValidationLevelInd></ValidationLevelInd>
<AdvanceShipmentNotificationId></AdvanceShipmentNotificationId>
<PoAttributeList>
<PoAttribute>
<Department></Department>
<FreightTerms></FreightTerms>
<Location></Location>
<LocationType></LocationType>
<MFOrderNo>MOMILQ</MFOrderNo>
<NotBeforeDate>2014-06-24 01:21:36</NotBeforeDate>
<PurchaseOrderType></PurchaseOrderType>
<RetekPurchaseOrderNo></RetekPurchaseOrderNo>
<sku></sku>
<Status></Status>
<Supplier></Supplier>
<SupplierDesc></SupplierDesc>
<upc></upc>
<VendorOrderNo></VendorOrderNo>
</PoAttribute>
<PoAttribute>
<Department></Department>
<FreightTerms></FreightTerms>
<Location></Location>
<LocationType></LocationType>
<MFOrderNo>MOMILN</MFOrderNo>
<NotBeforeDate>2014-06-24 01:21:36</NotBeforeDate>
<PurchaseOrderType></PurchaseOrderType>
<RetekPurchaseOrderNo></RetekPurchaseOrderNo>
<sku></sku>
<Status></Status>
<Supplier></Supplier>
<SupplierDesc></SupplierDesc>
<upc></upc>
<VendorOrderNo></VendorOrderNo>
</PoAttribute>
</PoAttributeList>
</AsnPODetails>
</AsnPODetailsRequest>
</soap:Body>
</soap:Envelope>
Желаемая XML:
<?xml version="1.0" encoding="utf-8"?>
<AsnPODetailsRequest>
<AsnPODetails>
<RequestSourcedFrom>EDI</RequestSourcedFrom>
<ValidationLevelInd></ValidationLevelInd>
<AdvanceShipmentNotificationId></AdvanceShipmentNotificationId>
<PoAttributeList>
<PoAttribute>
<Department></Department>
<FreightTerms></FreightTerms>
<Location></Location>
<LocationType></LocationType>
<MFOrderNo>MOMILQ</MFOrderNo>
<NotBeforeDate>2014-06-24 01:21:36</NotBeforeDate>
<PurchaseOrderType></PurchaseOrderType>
<RetekPurchaseOrderNo></RetekPurchaseOrderNo>
<sku></sku>
<Status></Status>
<Supplier></Supplier>
<SupplierDesc></SupplierDesc>
<upc></upc>
<VendorOrderNo></VendorOrderNo>
</PoAttribute>
<PoAttribute>
<Department></Department>
<FreightTerms></FreightTerms>
<Location></Location>
<LocationType></LocationType>
<MFOrderNo>MOMILN</MFOrderNo>
<NotBeforeDate>2014-06-24 01:21:36</NotBeforeDate>
<PurchaseOrderType></PurchaseOrderType>
<RetekPurchaseOrderNo></RetekPurchaseOrderNo>
<sku></sku>
<Status></Status>
<Supplier></Supplier>
<SupplierDesc></SupplierDesc>
<upc></upc>
<VendorOrderNo></VendorOrderNo>
</PoAttribute>
</PoAttributeList>
</AsnPODetails>
</AsnPODetailsRequest>
Я использую ниже XSLT
<xsl:stylesheet version="1.0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<!-- identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="soap:Envelope | soap:Body">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
</xsl:stylesheet>
но не вынимая Xmlns строки: мыло = "HTTP: //schemas.xmlsoap.org/soap/envelope/». он удаляет только мыло: Конверт и мыло: Тело. может ли кто-нибудь помочь мне написать XSLT, чтобы удалить теги, как я просил?
Просто крошечное примечание: '@ copy-namespaces' все равно копируют пространства имен, если узел, который нужно скопировать, является узлом элемента с именем в пространстве имен. Он просто удаляет неиспользуемые пространства имен, обязательные пространства имен, конечно, сохраняются как часть [процесса исправления пространства имен] (http://www.w3.org/TR/xslt20/#namespace-fixup). – Abel