【发布时间】:2020-10-30 20:17:54
【问题描述】:
我有以下代码,由 SOA JDeveloper 中的 XSLT 转换创建:
<xsl:stylesheet version="1.0"
xmlns:mhdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.mediator.service.common.functions.MediatorExtnFunction"
xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/db/dbSelectStores"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
xmlns:oracle-xsl-mapper="http://www.oracle.com/xsl/mapper/schemas"
xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue"
xmlns:oraxsl="http://www.oracle.com/XSL/Transform/java"
xmlns:ns0="http://www.xxxxx.it/BO/transformation/types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="http://www.xxxxx.it/bo/dataexchange"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsd oracle-xsl-mapper xsi xsl ns1 ns0 tns mhdr oraext xp20 xref socket dvm oraxsl"
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/"
xmlns:ns2="http://xmlns.oracle.com/pcbpel/adapter/db/IntegrationBackOffice/BOTransformations/dbSelectStores"
xmlns:client="http://xmlns.oracle.com/IntegrationBackOffice/BOTransformations/TransformationBPEL"
xmlns:ns3="http://xmlns.oracle.com/pcbpel/adapter/ftp/IntegrationBackOffice/BOTransformations/ftpCEDETLReference"> <xsl:param name="StoresInvoke_OutputVariable.dbSelectStoresOutputCollection"/><xsl:template match="/">
<tns:VSBODataExchange>
<tns:Import ImportId="{/ns0:input/ns0:flowId}" ImportDate="{xp20:current-date ( )}">
<tns:Stores>
<xsl:for-each select="$StoresInvoke_OutputVariable.dbSelectStoresOutputCollection/ns1:dbSelectStoresOutputCollection/ns1:dbSelectStoresOutput">
<tns:Store Operation="IU" ItemNo="{position ( )}">
<tns:StoreId>
<xsl:value-of select="oraext:right-trim(ns1:BS1000)"/>
</tns:StoreId>
</tns:Store>
</xsl:for-each>
</tns:Stores>
</tns:Import>
</tns:VSBODataExchange>
</xsl:template> </xsl:stylesheet>
这是输出:
<?xml version="1.0" encoding="UTF-8"?>
<VSBODataExchange xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/" xmlns:ns2="http://xmlns.oracle.com/pcbpel/adapter/db/IntegrationBackOfficeToshiba/BOTransformations/dbSelectStores" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:ns3="http://xmlns.oracle.com/pcbpel/adapter/ftp/IntegrationBackOfficeToshiba/BOTransformations/ftpCEDETLReference" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:client="http://xmlns.oracle.com/IntegrationBackOfficeToshiba/BOTransformations/TransformationBPEL" xmlns:tns="http://www.gabriellispa.it/bo/toshiba/dataexchange" xmlns="http://www.gabriellispa.it/bo/toshiba/dataexchange">
<tns:Import ImportId="420036" ImportDate="2020-07-07">
<tns:Stores>
<tns:Store Operation="IU" ItemNo="1">
<tns:StoreId>401</tns:StoreId>
</tns:Store>
</tns:Stores>
</tns:Import>
</VSBODataExchange>
但我的输出必须在元素标记中没有“tns:”,并且可能在 xsl 样式表中没有“xmlns:”,如下所示:
<?xml version="1.0" encoding="UTF-8" ?>
<VSBODataExchange>
<Import ImportId="5" ImportDate="2018-08-06">
<Stores>
<Store Operation="IU" ItemNo="1">
<StoreId>1</StoreId>
</Store>
</Stores>
</Import>
如何替换标记元素中的“tns:”并从输出的样式表中删除所有“xmls:...”? 提前致谢。
【问题讨论】: