我需要根据DVM查找表的数字输出,以特定顺序发送一些xml节点(我需要设置节点的顺序) 尝试使用xsl排序不起作用
DVM表:
CD_MPT_TYPE KY_METER_PROG RDG_USE CD_RDG_TYPE SEQ_NO
----------- ------------- ------- ----------- ------
004 014 02 010 1
004 014 02 030 2
004 014 02 040 3
我的XSLT:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:oraxsl="http://www.oracle.com/XSL/Transform/java"
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:ns0="http://nationalgrid.com/WO_UPDSATES_SVC_IN_ChangeWorkOrderStatus_request"
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:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue"
xmlns:oracle-xsl-mapper="http://www.oracle.com/xsl/mapper/schemas"
xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsd xsi oracle-xsl-mapper xsl ns0 oraxsl xp20 xref mhdr oraext dvm socket"
xmlns:inp2="http://nationalgrid.com/WO_UPDSATES_SVC_IN_ChangeWorkOrderStatus_response"
xmlns:tns="http://xmlns.oracle.com/GBE_INGR_APP/GBE_INT_WO_UPDATES_SVC/WO_UPDATE_SVC_IN"
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/jms/GBE_INGR_APP/GBE_INT_WO_UPDATES_SVC/JMS_WO_COMPLETE_IN"
xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/"
xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
<oracle-xsl-mapper:schema>
<!--SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY.-->
<oracle-xsl-mapper:mapSources>
<oracle-xsl-mapper:source type="WSDL">
<oracle-xsl-mapper:schema location="../WSDLs/WO_UPDATE_SVC_IN.wsdl"/>
<oracle-xsl-mapper:rootElement name="updatesWORequest"
namespace="http://nationalgrid.com/WO_UPDSATES_SVC_IN_ChangeWorkOrderStatus_request"/>
</oracle-xsl-mapper:source>
</oracle-xsl-mapper:mapSources>
<oracle-xsl-mapper:mapTargets>
<oracle-xsl-mapper:target type="WSDL">
<oracle-xsl-mapper:schema location="../WSDLs/JMS_WO_COMPLETE_IN.wsdl"/>
<oracle-xsl-mapper:rootElement name="inbound" namespace=""/>
</oracle-xsl-mapper:target>
</oracle-xsl-mapper:mapTargets>
<!--GENERATED BY ORACLE XSL MAPPER 12.1.3.0.0(XSLT Build 140529.0700.0211) AT [THU JUL 18 06:28:09 EDT 2019].-->
</oracle-xsl-mapper:schema>
<!--User Editing allowed BELOW this line - DO NOT DELETE THIS LINE-->
<xsl:template match="/">
<inbound>
<close_wrk>
<mtr_data>
<prog_id>
<xsl:value-of select="/ns0:updatesWORequest/ns0:member/ns0:woserviceaddress/ns0:meterdata/ns0:ng_programid"/>
</prog_id>
<mtr_stat_left/>
<mpt_type>
<xsl:value-of select="/ns0:updatesWORequest/ns0:member/ns0:woserviceaddress/ns0:meterdata/ns0:ng_meterpointtype"/>
</mpt_type>
<xsl:variable name="meterpointvar"
select="/ns0:updatesWORequest/ns0:member/ns0:woserviceaddress/ns0:meterdata/ns0:ng_meterpointtype"/>
<xsl:variable name="progidvar"
select="/ns0:updatesWORequest/ns0:member/ns0:woserviceaddress/ns0:meterdata/ns0:ng_programid"/>
<xsl:for-each select="/ns0:updatesWORequest/ns0:member/ns0:woserviceaddress/ns0:meterdata/ns0:cmsmtrreadings">
<rdg_data>
<rdg_type>
<xsl:value-of select="ns0:ng_readtype"/>
</rdg_type>
<xsl:variable name="readtypevar" select="ns0:ng_readtype"/>
<index>
<xsl:value-of select="ns0:ng_multiplier"/>
</index>
<rdg_use>
<xsl:value-of select="ns0:ng_usage"/>
</rdg_use>
<xsl:variable name="usagevar" select="ns0:ng_usage"/>
<xsl:variable name="ng_readtypedata"
select="dvm:lookupValue ('DVM/COM_VALUE_READTYPEDATASEQUENCE.dvm', 'CD_MPT_TYPE',$meterpointvar, 'KY_DISPLAY_SEQ_NO','10', 'KY_METER_PROG',$progidvar, 'CD_RDG_USE', $usagevar,'CD_RDG_TYPE',$readtypevar )"/>
<dials>
<xsl:value-of select="$ng_readtypedata"/>
</dials>
</rdg_data>
</xsl:for-each>
</mtr_data>
</close_wrk>
</inbound>
</xsl:template>
</xsl:stylesheet>
源XML 这是我在上面的XSLT中输入的xml。
<?xml version="1.0" encoding="UTF-8" ?>
<updatesWORequest xmlns="http://nationalgrid.com/WO_UPDSATES_SVC_IN_ChangeWorkOrderStatus_request">
<member>
<status>Work_Order_Complete</status>
<wosfdcid>0WO0t0000008GcqGAE</wosfdcid>
<sfwonum>00127837</sfwonum>
<wonum>321806</wonum>
<workorderid>321321</workorderid>
<siteid xmlns="">NGRID</siteid>
<woserviceaddress>
<ng_cssrirefid>22222222</ng_cssrirefid>
<ng_originaljob>22222222</ng_originaljob>
<wostartdate>2019-07-11T17:31:08.000Z</wostartdate>
<ng_premisenumber>00000000</ng_premisenumber>
<woenddate>2019-07-11T17:33:42.000Z</woenddate>
<ng_assignedtech>88888888</ng_assignedtech>
<ng_companycode>Massachusetts Electric Company</ng_companycode>
<ng_fieldordertype xmlns="">Investigate - Meter-High Bill</ng_fieldordertype>
<ng_custname>DRACUT TIRE SHOP</ng_custname>
<ng_towncode>0022</ng_towncode>
<ng_opcenter>North Andover</ng_opcenter>
<ng_billaccountnumber>999999999</ng_billaccountnumber>
<ng_billgroupcycle>15</ng_billgroupcycle>
<ng_orderremarks>Comments</ng_orderremarks>
<ng_override>false</ng_override>
<ng_meterphase xmlns=""/>
<ng_changeoldcustomerinfo>false</ng_changeoldcustomerinfo>
<ng_requestareacode/>
<ng_requestedphone>(978)957-0782</ng_requestedphone>
<ng_businessareacode/>
<ng_businessphone>(978) 957-0752</ng_businessphone>
<ng_csspole/>
<meterdata>
<ng_mtrpointnum>1</ng_mtrpointnum>
<ng_srvpointnum>88888888</ng_srvpointnum>
<ng_meterid>05046292</ng_meterid>
<ng_readingdevice>AAA</ng_readingdevice>
<ng_programid>014</ng_programid> <!-- changed it from 129 MAX DEM KVA to 000 for testing purpose -->
<ng_meterpointtype>004</ng_meterpointtype>
<ng_ertno>52314117</ng_ertno>
<ng_ertmfgr>Elec - Schlumberger</ng_ertmfgr>
<ng_ertmodel>Electric KJ40OEM-308</ng_ertmodel>
<ng_ertchangeflag>false</ng_ertchangeflag>
<ng_mptloc>Attic</ng_mptloc>
<ng_changeoldmeterflag>false</ng_changeoldmeterflag>
<ng_srvpointtype>Electric</ng_srvpointtype>
<ng_meterphase>Three</ng_meterphase>
<cmsmtrreadings>
<ng_readtype>030</ng_readtype>
<ng_usage>02</ng_usage>
<ng_multiplier>00001.000</ng_multiplier>
<newreading>60.00</newreading>
<ng_dials>5</ng_dials>
</cmsmtrreadings>
<cmsmtrreadings>
<ng_readtype>010</ng_readtype>
<ng_usage>02</ng_usage>
<ng_multiplier>00001.000</ng_multiplier>
<newreading>60.00</newreading>
<ng_dials>5</ng_dials>
</cmsmtrreadings>
<cmsmtrreadings>
<ng_readtype>040</ng_readtype>
<ng_usage>02</ng_usage>
<ng_multiplier>000000001.000</ng_multiplier>
<newreading>0</newreading>
<ng_dials>5</ng_dials>
</cmsmtrreadings>
</meterdata>
</woserviceaddress>
<ng_rnwflag>0</ng_rnwflag>
<ng_sfordertype>Investigate - Meter-High Bill</ng_sfordertype>
</member>
</updatesWORequest>
目标XML 这是测试后的目标XML文件
<?xml version = '1.0' encoding = 'UTF-8'?>
<inbound xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/jms/GBE_INGR_APP/GBE_INT_WO_UPDATES_SVC/JMS_WO_COMPLETE_IN" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:inp2="http://nationalgrid.com/WO_UPDSATES_SVC_IN_ChangeWorkOrderStatus_response" xmlns:tns="http://xmlns.oracle.com/GBE_INGR_APP/GBE_INT_WO_UPDATES_SVC/WO_UPDATE_SVC_IN" xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
<close_wrk>
<mtr_data>
<prog_id>014</prog_id>
<mtr_stat_left/>
<mpt_type>004</mpt_type>
<rdg_data>
<rdg_type>030</rdg_type>
<index>00001.000</index>
<rdg_use>02</rdg_use>
<dials>2</dials>
</rdg_data>
<rdg_data>
<rdg_type>010</rdg_type>
<index>00001.000</index>
<rdg_use>02</rdg_use>
<dials>1</dials>
</rdg_data>
<rdg_data>
<rdg_type>040</rdg_type>
<index>000000001.000</index>
<rdg_use>02</rdg_use>
<dials>3</dials>
</rdg_data>
</mtr_data>
</close_wrk>
</inbound>
预期结果:
节点应顺序排列。我放大了序列号以进行标记
<?xml version = '1.0' encoding = 'UTF-8'?>
<inbound xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/jms/GBE_INGR_APP/GBE_INT_WO_UPDATES_SVC/JMS_WO_COMPLETE_IN" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:inp2="http://nationalgrid.com/WO_UPDSATES_SVC_IN_ChangeWorkOrderStatus_response" xmlns:tns="http://xmlns.oracle.com/GBE_INGR_APP/GBE_INT_WO_UPDATES_SVC/WO_UPDATE_SVC_IN" xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
<close_wrk>
<mtr_data>
<prog_id>014</prog_id>
<mtr_stat_left/>
<mpt_type>004</mpt_type>
<rdg_data>
<rdg_type>010</rdg_type>
<index>00001.000</index>
<rdg_use>02</rdg_use>
<dials>1</dials>
</rdg_data>
<rdg_data>
<rdg_type>030</rdg_type>
<index>00001.000</index>
<rdg_use>02</rdg_use>
<dials>2</dials>
</rdg_data>
<rdg_data>
<rdg_type>040</rdg_type>
<index>000000001.000</index>
<rdg_use>02</rdg_use>
<dials>3</dials>
</rdg_data>
</mtr_data>
</close_wrk>
</inbound>
此DVM的输出将为列SEQ_NO
基于列“ SEQ_NO”的值,我需要以此顺序发送以下xsl节点</rdg_data>
。
示例:如果上表中组合的结果为1,则应首先发送特定的<rdg_data>
节点。
如果是2,则应发送第二个,等等