我找到了上一期的解决方案,现在新的问题是: 如果我有以下一组请求:
<notification>
<transaction id="B0GQ95PH07QR"/>
<info origin="INT.02" type="NPM Event" hostname="prmrte02" time="2015-02-28T02:26:42+02:00"/>
<data>
<admin originator="" event_time="2015-02-28T02:26:42+02:00">
<input>
<request_set tx_id="Y2xfMDFfMDE6LWFjODQ2MTQ6Y2E3Mjo1NGVmYjA3NjoxNTE3ODA=#YWM4NDYxNDpjYTcyOjU0ZWZiMDc2OjE1MTc5Ng==" tx_timeout="2015-02-28T00:36:51.824Z" tx_command="start">
<transaction id="B0GQ95PH07QR"/>
<request report="">
<update>
<account_data id="2005637" parent="3615732" Status="5" instance="1">
<info>
<additional languageid="ARA" nwop="WMP" expdat="2015-08-17T00:00:00+02:00" exptyp="Deactivate" status="5" as="PAS/SUSP" dyn="ch=US,gn=,ct=1,enc=true,tp=TP_STUDENTS"/>
</info>
<event_map>
<item id="101" value="ARA"/>
<item id="102" value="WMP"/>
<item id="110" value="2015-08-17T00:00:00.000+02:00"/>
<item id="111" value="Deactivate"/>
</event_map>
<map>
<item id="3" name="TOKEN" value="1234567" vfrom="2014-10-28T21:51:36+02:00"/>
<item id="2" name="MSISDN" value="1234567" vfrom="2014-10-28T21:51:36+02:00"/>
<item id="1" name="IMSI" value="425062260312424" vfrom="2014-10-28T21:51:36+02:00"/>
</map>
<balances>
<item id="40" name="BLC_Points_Limit" value="0.0" rollover_cnt="0"/>
<item id="50" name="BLP_Bonus_GeoPoll" value="0.0" rollover_cnt="0"/>
<item id="3" name="BLP_Bonus" value="0.0" rollover_cnt="0"/>
<item id="38" name="BLC_Transfered_Points" value="0.0" rollover_cnt="0"/>
<item id="39" name="BLC_TP" value="0.0" rollover_cnt="0"/>
<item id="22" name="BLC_Points" value="0.0" rollover_cnt="0"/>
<item id="62" name="BLB_PSR_Flag" value="0.0" rollover_cnt="0"/>
<item id="43" name="BLP_Bonus_Points" value="0.0" rollover_cnt="0"/>
<item id="1" name="BLP_Main" value="0.0" rollover_cnt="0"/>
<item id="32" name="BLC_SEC_OFFNET_MTC" value="0.0" rollover_cnt="0"/>
<item id="34" name="BLC_CT_USAGE" value="0.0" rollover_cnt="0"/>
<item id="2" name="BLP_Debt" value="0.0" rollover_cnt="0"/>
<item id="53" name="BLP_Act_Gift" value="0.0" rollover_cnt="0"/>
</balances>
<recurring>
<item id="38" index="1" spc_id="30957767" bundle_id="61" start_date="2015-02-19T20:45:34+02:00"/>
</recurring>
<service_options>
<item id="1" bundle_id="1" state="1" spc_id="25284120"/>
<item id="1209" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284259"/>
<item id="1192" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284225"/>
<item id="1296" usdate="2014-10-28T21:51:36+02:00" bundle_id="65" state="0" spc_id="25284378"/>
<item id="1198" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284136"/>
<item id="1020" usdate="2014-10-28T21:51:36+02:00" bundle_id="56" state="0" spc_id="25284301"/>
<item id="1201" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284233"/>
<item id="1179" usdate="2014-10-28T21:51:36+02:00" bundle_id="60" state="0" spc_id="25284088"/>
<item id="1174" usdate="2014-10-28T21:51:36+02:00" bundle_id="60" state="0" spc_id="25284099"/>
<item id="1193" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284167"/>
<item id="1202" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284271"/>
<item id="1328" usdate="2015-02-27T21:49:35+02:00" bundle_id="74" state="0" spc_id="31047013"/>
<item id="1295" usdate="2015-02-17T11:13:04+02:00" bundle_id="60" state="0" spc_id="30914089"/>
<item id="1190" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284195"/>
<item id="1194" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284155"/>
<item id="1292" usdate="2014-10-28T21:51:36+02:00" bundle_id="65" state="0" spc_id="25284363"/>
<item id="1207" usdate="2014-10-28T21:51:36+02:00" bundle_id="65" state="0" spc_id="25284336"/>
<item id="1210" usdate="2014-10-28T21:51:36+02:00" bundle_id="65" state="0" spc_id="25284350"/>
<item id="1200" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284248"/>
<item id="1197" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284181"/>
<item id="1307" usdate="2014-10-28T21:51:36+02:00" bundle_id="60" state="0" spc_id="25284076"/>
<item id="1195" usdate="2014-10-28T21:51:36+02:00" bundle_id="1" state="0" spc_id="25284208"/>
<item id="1284" usdate="2015-02-19T20:45:34+02:00" bundle_id="61" state="0"/>
</service_options>
<ps_options>
<item id="6" name="PO_FF_ONNET_10IN1">
<match value="1" vfrom="2015-02-19T20:45:35+02:00">0769723924</match>
</item>
</ps_options>
<thresholds accountId="2005637" seqno="13">
<item name="TH_BLC_Points_Allow_Redeem" id="502" class="BAS" new_level="HIGH,LOW" nlid="2,1"/>
<item name="TH_LI_BLP_Main" id="501" class="EXTERNAL" new_level="HIGH,LOW" nlid="2,1"/>
<item name="Threshold_PreCallAnnouncements" id="510" class="EXTERNAL" new_level="HIGH,LOW" nlid="3,2"/>
<item name="THR_BLB_SMS_ONNET" id="509" class="EXTERNAL" new_level="HIGH" nlid="3"/>
<item name="THR_BLB_MMS_ONNET" id="505" class="EXTERNAL" new_level="HIGH" nlid="3"/>
<item name="THR_BLB_GPRS" id="503" class="EXTERNAL" new_level="HIGH,LOW,ZERO" nlid="3,2,1"/>
</thresholds>
</account_data>
</update>
</request>
<request report="">
<update>
<account_data id="3615734" parent="3615732" Status="5" instance="1">
<info>
<additional languageid="ARA" nwop="WMP" status="5" as="PAS/SUSP" dyn="ch=US,gn=,ct=1,enc=true,tp=TP_SHABABE"/>
</info>
<event_map>
<item id="101" value="ARA"/>
<item id="102" value="WMP"/>
</event_map>
<map>
<item id="1" name="IMSI" value="425062250251886" vfrom="2014-04-01T14:49:46+02:00"/>
<item id="3" name="TOKEN" value="768681826" vfrom="2014-04-01T14:49:46+02:00"/>
<item id="2" name="MSISDN" value="768681826" vfrom="2014-04-01T14:49:46+02:00"/>
</map>
<balances>
<item id="39" name="BLC_TP" value="0.0" rollover_cnt="0"/>
<item id="1" name="BLP_Main" value="0.0" rollover_cnt="0"/>
<item id="43" name="BLP_Bonus_Points" value="0.0" rollover_cnt="0"/>
<item id="2" name="BLP_Debt" value="0.0" rollover_cnt="0"/>
<item id="40" name="BLC_Points_Limit" value="0.0" rollover_cnt="0"/>
<item id="3" name="BLP_Bonus" value="0.0" rollover_cnt="0"/>
<item id="50" name="BLP_Bonus_GeoPoll" value="0.0" rollover_cnt="0"/>
<item id="38" name="BLC_Transfered_Points" value="0.0" rollover_cnt="0"/>
<item id="22" name="BLC_Points" value="0.0" rollover_cnt="0"/>
<item id="62" name="BLB_PSR_Flag" value="0.0" rollover_cnt="0"/>
<item id="32" name="BLC_SEC_OFFNET_MTC" value="0.0" rollover_cnt="0"/>
<item id="83" name="BLC_FF_Shababe_CAP_Period" value="0.0" rollover_cnt="0"/>
<item id="53" name="BLP_Act_Gift" value="0.0" rollover_cnt="0"/>
</balances>
<service_options>
<item id="1" bundle_id="1" state="0" spc_id="28054950"/>
<item id="1292" usdate="2014-04-23T12:49:14+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="65" state="0" spc_id="28055113"/>
<item id="1194" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055028"/>
<item id="1193" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055051"/>
<item id="1179" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="60" state="0" spc_id="28054905"/>
<item id="1202" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055046"/>
<item id="1209" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055038"/>
<item id="1200" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055004"/>
<item id="1210" usdate="2014-04-23T12:49:14+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="65" state="0" spc_id="28055104"/>
<item id="1208" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="66" state="0" spc_id="28054733"/>
<item id="1190" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055075"/>
<item id="1195" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055033"/>
<item id="1174" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="60" state="0" spc_id="28054894"/>
<item id="1197" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055068"/>
<item id="1201" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055013"/>
<item id="1207" usdate="2014-04-23T12:49:14+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="65" state="0" spc_id="28055097"/>
<item id="1168" usdate="2014-11-26T14:40:31+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="59" state="0" spc_id="28054856"/>
<item id="1296" usdate="2014-04-23T12:49:14+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="65" state="0" spc_id="28055122"/>
<item id="1307" usdate="2014-04-23T12:49:14+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="60" state="0" spc_id="28054886"/>
<item id="1198" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28054991"/>
<item id="1169" usdate="2014-11-04T05:33:04+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="59" state="0" spc_id="28054849"/>
<item id="1192" usdate="2014-04-01T14:49:46+02:00" uedate="2015-02-02T05:33:05+02:00" bundle_id="1" state="0" spc_id="28055059"/>
</service_options>
<ps_options>
<item id="6" name="PO_FF_ONNET_10IN1">
<match value="1">0769723924</match>
</item>
</ps_options>
<thresholds accountId="3615734" seqno="2">
<item name="TH_LI_BLP_Main" id="501" class="EXTERNAL" new_level="HIGH,LOW" nlid="2,1"/>
<item name="Threshold_PreCallAnnouncements" id="510" class="EXTERNAL" new_level="HIGH,LOW" nlid="3,2"/>
<item name="TH_BLC_Points_Allow_Redeem" id="502" class="BAS" new_level="HIGH,LOW" nlid="2,1"/>
</thresholds>
</account_data>
</update>
</request>
</request_set>
</input>
<output>
<response_set code="0">
<transaction id="B0GQ95PH07QR"/>
<text>Ok</text>
<response code="0">
<text>Ok</text>
<update>
<account_data id="2005637" parent="3615732" Status="2">
<thresholds seqno="12"/>
<map>
<item id="1" value="425062260312424"/>
<item id="2" value="769874479"/>
</map>
</account_data>
</update>
</response>
<response code="0">
<text>Ok</text>
<update>
<account_data id="3615734" parent="3615732" Status="5">
<thresholds seqno="1"/>
<map>
<item id="1" value="425062250251886"/>
<item id="2" value="768681826"/>
</map>
</account_data>
</update>
</response>
</response_set>
</output>
</admin>
</data>
</notification>
应用于此输入文件的当前XSLT将捕获以下内容:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/">
<xsl:variable name="UID">
<xsl:value-of select="ND-OFM-04"/>
</xsl:variable>
<xsl:variable name="LANG">
<xsl:value-of select="/notification/data/admin/input/request_set/request/update/account_data/info/additional/@languageid"/>
</xsl:variable>
<xsl:variable name="IMSI">
<xsl:value-of select="/notification/data/admin/input/request_set/request/update/account_data/map/item[@id = 1 and not(@vto)]/@value"/>
</xsl:variable>
<xsl:variable name="MSISDN">
<xsl:value-of select="/notification/data/admin/input/request_set/request/update/account_data/map/item[@id = 2 and not(@vto)]/@value"/>
</xsl:variable>
<xsl:variable name="NOTIFID">
<xsl:value-of select="/notification/transaction/@id"/>
</xsl:variable>
<xsl:variable name="ACID">
<xsl:value-of select="/notification/data/admin/input/request_set/request/update/account_data[@Status='5']/@id"/>
</xsl:variable>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gol="http://www.example.org/ws/GOldEventTransaction">
<soapenv:Header/>
<soapenv:Body>
<gol:GoldEventTransactionMessageInput>
<gol:MessageHeader>
<gol:NotificationID>GOLD<xsl:value-of select="concat($NOTIFID, 'DEACT')"/>
</gol:NotificationID>
<gol:GoldNodeType/>
<gol:NotificationType>DEACTIVATION</gol:NotificationType>
</gol:MessageHeader>
<gol:MessageBody>
<gol:SubscriberInformation>
<gol:SubscriberID>
<xsl:value-of select="$ACID"/>
</gol:SubscriberID>
<gol:SubscriberMSISDN>
<xsl:value-of select="$MSISDN"/>
</gol:SubscriberMSISDN>
<gol:SubscriberIMSI>
<xsl:value-of select="$IMSI"/>
</gol:SubscriberIMSI>
<gol:SubscriberLangID>
<xsl:value-of select="$LANG"/>
</gol:SubscriberLangID>
</gol:SubscriberInformation>
<gol:StateInformation>
<gol:FState>ACT/STD</gol:FState>
<gol:TState>PAS/SUSP</gol:TState>
</gol:StateInformation>
</gol:MessageBody>
</gol:GoldEventTransactionMessageInput>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
<xsl:template name="strip_comma">
<xsl:param name="level"/>
<xsl:choose>
<xsl:when test="contains($level, ',')">
<xsl:call-template name="strip_comma">
<xsl:with-param name="level">
<xsl:value-of select="substring-after($level,',')"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$level"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
XSLT将过滤将仅显示第一个请求输出,而第二个请求不会显示。 电流输出
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gol="http://www.example.org/ws/GOldEventTransaction"><soapenv:Header/><soapenv:Body><gol:GoldEventTransactionMessageInput><gol:MessageHeader><gol:NotificationID>GOLDB0GQ95PH07QRDEACT</gol:NotificationID><gol:GoldNodeType/><gol:NotificationType>DEACTIVATION</gol:NotificationType></gol:MessageHeader><gol:MessageBody><gol:SubscriberInformation><gol:SubscriberID>2005637</gol:SubscriberID><gol:SubscriberMSISDN>1234567</gol:SubscriberMSISDN><gol:SubscriberIMSI>425062260312424</gol:SubscriberIMSI><gol:SubscriberLangID>ARA</gol:SubscriberLangID></gol:SubscriberInformation><gol:StateInformation><gol:FState>ACT/STD</gol:FState><gol:TState>PAS/SUSP</gol:TState></gol:StateInformation></gol:MessageBody></gol:GoldEventTransactionMessageInput></soapenv:Body></soapenv:Envelope>
虽然我想要实现的是:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gol="http://www.example.org/ws/GOldEventTransaction"><soapenv:Header/><soapenv:Body><gol:GoldEventTransactionMessageInput><gol:MessageHeader><gol:NotificationID>GOLDB0GQ95PH07QRDEACT</gol:NotificationID><gol:GoldNodeType/><gol:NotificationType>DEACTIVATION</gol:NotificationType></gol:MessageHeader><gol:MessageBody><gol:SubscriberInformation><gol:SubscriberID>2005637</gol:SubscriberID><gol:SubscriberMSISDN>1234567</gol:SubscriberMSISDN><gol:SubscriberIMSI>425062260312424</gol:SubscriberIMSI><gol:SubscriberLangID>ARA</gol:SubscriberLangID></gol:SubscriberInformation><gol:StateInformation><gol:FState>ACT/STD</gol:FState><gol:TState>PAS/SUSP</gol:TState></gol:StateInformation></gol:MessageBody></gol:GoldEventTransactionMessageInput></soapenv:Body></soapenv:Envelope>
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gol="http://www.example.org/ws/GOldEventTransaction"><soapenv:Header/><soapenv:Body><gol:GoldEventTransactionMessageInput><gol:MessageHeader><gol:NotificationID>GOLDB0GQ95PH07QRDEACT</gol:NotificationID><gol:GoldNodeType/><gol:NotificationType>DEACTIVATION</gol:NotificationType></gol:MessageHeader><gol:MessageBody><gol:SubscriberInformation><gol:SubscriberID>3615734</gol:SubscriberID><gol:SubscriberMSISDN>768681826</gol:SubscriberMSISDN><gol:SubscriberIMSI>425062250251886</gol:SubscriberIMSI><gol:SubscriberLangID>ARA</gol:SubscriberLangID></gol:SubscriberInformation><gol:StateInformation><gol:FState>ACT/STD</gol:FState><gol:TState>PAS/SUSP</gol:TState></gol:StateInformation></gol:MessageBody></gol:GoldEventTransactionMessageInput></soapenv:Body></soapenv:Envelope>
那就是循环每一个请求并应用相同的检查现在正在进行
请帮助!!!
答案 0 :(得分:1)
我想要一个循环所有请求的XSLT表达式,检查一下 状态为5,并返回包含每个不同帐户ID的输出 输入。
你没有说出输出应该采用什么形式。以下是将每个id作为XML文档中的元素返回的示例:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<result>
<xsl:for-each select="notification/data/admin/input/request_set/request/update/account_data[@Status='5']">
<id>
<xsl:value-of select="@id"/>
</id>
</xsl:for-each>
</result>
</xsl:template>
</xsl:stylesheet>
应用于您的(原始)示例输入:
XML
<notification>
<data>
<admin originator="" event_time="2015-02-28T02:26:42+02:00">
<input>
<request_set tx_id="Y2xfMDFfMDE6LWFjODQ2MTQ6Y2E3Mjo1NGVmYjA3NjoxNTE3ODA=#YWM4NDYxNDpjYTcyOjU0ZWZiMDc2OjE1MTc5Ng==" tx_timeout="2015-02-28T00:36:51.824Z" tx_command="start">
<request report="">
<update>
<account_data id="2005637" parent="3615732" Status="5" instance="1">
<info>
<additional languageid="ARA" nwop="WMP" expdat="2015-08-17T00:00:00+02:00" exptyp="Deactivate" status="2" as="ACT/STD" dyn="ch=US,gn=,ct=1,enc=true,tp=TP_STUDENTS"/>
</info>
</account_data>
</update>
</request>
<request report="">
<update>
<account_data id="3615734" parent="3615732" Status="5" instance="1">
<info>
<additional languageid="ARA" nwop="WMP" status="5" as="PAS/SUSP" dyn="ch=US,gn=,ct=1,enc=true,tp=TP_SHABABE"/>
</info>
</account_data>
</update>
</request>
</request_set>
</input>
</admin>
</data>
</notification>
结果是:
<?xml version="1.0" encoding="UTF-8"?>
<result>
<id>2005637</id>
<id>3615734</id>
</result>