我有两个变量。一个是输入,第二个是DB。在for循环中,我尝试将INPUT / numberVPN与DB / userid匹配(它们的排序方式不同,但输入中的所有数字都存在于DB变量中)。
现在一旦找到它,我希望将当前的DB / OLD_PID映射到Input / profileCode,而不是第一个。我总是得到第一,第二,......
INPUT变量(删除不需要/分类的数据):
<ns7:VPNProvisioning>
<VPNScenario>
<profileCodeCollection>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil3</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
<profileCode>Profil4</profileCode>
</profileCodeCollection>
<numberVPNCollection>
<numberVPN>0099962330481</numberVPN>
<numberVPN>0099962342864</numberVPN>
<numberVPN>0099962342865</numberVPN>
<numberVPN>0099962342867</numberVPN>
<numberVPN>0099962342868</numberVPN>
<numberVPN>0099962342869</numberVPN>
<numberVPN>0099962342870</numberVPN>
<numberVPN>0099962342871</numberVPN>
<numberVPN>0099962342873</numberVPN>
<numberVPN>0099962342882</numberVPN>
<numberVPN>0099962342883</numberVPN>
<numberVPN>0099962343623</numberVPN>
<numberVPN>0099962343624</numberVPN>
<numberVPN>0099962343625</numberVPN>
<numberVPN>0099962343626</numberVPN>
<numberVPN>0099962343627</numberVPN>
<numberVPN>0099932406802</numberVPN>
<numberVPN>0099932618450</numberVPN>
<numberVPN>0099932691124</numberVPN>
<numberVPN>0099932691244</numberVPN>
<numberVPN>0099932691373</numberVPN>
<numberVPN>0099932691376</numberVPN>
<numberVPN>0099932691474</numberVPN>
<numberVPN>0099932691491</numberVPN>
<numberVPN>0099932691531</numberVPN>
<numberVPN>0099961153082</numberVPN>
<numberVPN>0099961153083</numberVPN>
<numberVPN>0099961153084</numberVPN>
<numberVPN>0099961153085</numberVPN>
<numberVPN>0099961153318</numberVPN>
<numberVPN>0099961166999</numberVPN>
<numberVPN>0099961166388</numberVPN>
<numberVPN>0099961176716</numberVPN>
<numberVPN>0099961473357</numberVPN>
<numberVPN>0099961473368</numberVPN>
<numberVPN>0099962336527</numberVPN>
</numberVPNCollection>
</VPNScenario>
</ns7:VPNProvisioning>
数据库变量:
<fget_esinfo4vpnterminateOutputCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/fget_esinfo4vpnterminate">
<fget_esinfo4vpnterminateOutput>
<USERID>032/406802</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/618450</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691124</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691244</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691373</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691376</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691474</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691491</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691531</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153082</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153083</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153084</USERID>
<OLD_PID>400004</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153085</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153318</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/166387</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/166388</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/176716</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/473357</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/473368</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/330481</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/336527</USERID>
<OLD_PID>400004</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342864</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342865</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342867</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342868</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342869</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342870</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342871</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342873</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342882</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342883</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343623</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343624</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343625</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343626</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343627</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
BPEL的XSLT代码:
<xsl:template match="/">
<ns6:VPNProvisioning>
<VPNScenarioCollection>
<VPNScenario>
<profileCodeCollection>
<xsl:for-each select="$esinfo4vpnterminate_OutputVariable.fget_esinfo4vpnterminateOutputCollection/db:fget_esinfo4vpnterminateOutputCollection/db:fget_esinfo4vpnterminateOutput">
<xsl:if test='concat("00999",substring-before(substring(db:USERID,2.0),"/"),substring-after(db:USERID,"/")) = /ns1:ORDCOMPLETE/ns1:VPNProvisioning/VPNScenario/numberVPNCollection/numberVPN'>
<profileCode>
<xsl:value-of select="db:OLD_PID"/>
</profileCode>
</xsl:if>
</xsl:for-each>
</profileCodeCollection>
</VPNScenario>
</VPNScenarioCollection>
</ns6:VPNProvisioning>
所以我的目标是:
对于输入变量中的每个数字,在db变量中找到相同的内容(忽略不同的格式,正确解析它)。然后,从找到匹配的节点,取old_pid并在输入变量中输入配置文件代码。
答案 0 :(得分:0)
我不了解BPEL,但您的目标可以或多或少地直接转换为xslt,简化:
对于一个工作示例,我不得不删除一些名称空间并假设INPUT是输入到xslt而不是变量,但这是一个起点。我将INPUT保存为单独的文件,并运行以下xslt:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="exsl"
xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/fget_esinfo4vpnterminate">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="db">
<fget_esinfo4vpnterminateOutputCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/fget_esinfo4vpnterminate">
<fget_esinfo4vpnterminateOutput>
<USERID>032/406802</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/618450</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691124</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691244</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691373</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691376</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691474</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691491</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>032/691531</USERID>
<OLD_PID>100002</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153082</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153083</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153084</USERID>
<OLD_PID>400004</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153085</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/153318</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/166387</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/166388</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/176716</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/473357</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>061/473368</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/330481</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/336527</USERID>
<OLD_PID>400004</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342864</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342865</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342867</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342868</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342869</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342870</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342871</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342873</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342882</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/342883</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343623</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343624</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343625</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343626</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
<fget_esinfo4vpnterminateOutput>
<USERID>062/343627</USERID>
<OLD_PID>400001</OLD_PID>
</fget_esinfo4vpnterminateOutput>
</fget_esinfo4vpnterminateOutputCollection>
</xsl:variable>
<xsl:template match="/">
<VPNProvisioning>
<VPNScenarioCollection>
<VPNScenario>
<profileCodeCollection>
<xsl:apply-templates select="/VPNProvisioning/VPNScenario/numberVPNCollection/numberVPN" />
</profileCodeCollection>
</VPNScenario>
</VPNScenarioCollection>
</VPNProvisioning>
</xsl:template>
<xsl:template match="numberVPN">
<xsl:variable name="number" select="concat('0',substring(text(),6,2),'/',substring(text(),8))"/>
<profileCode>
<xsl:value-of select="exsl:node-set($db)/db:fget_esinfo4vpnterminateOutputCollection/db:fget_esinfo4vpnterminateOutput[db:USERID = $number]/db:OLD_PID"/>
</profileCode>
</xsl:template>
</xsl:stylesheet>
我必须使用node-set extension function才能在select中使用变量。
答案 1 :(得分:0)
我不得不使用节点名称,而是使用'。'选择for循环中的当前值。解决方案是:
<xsl:for-each select="/ns1:ORDCOMPLETE/ns1:VPNProvisioning/VPNScenario/numberVPNCollection/numberVPN">
<xsl:variable name="foo" select="."/>
<xsl:variable name="dbout"
select="$esinfo4vpnterminate_OutputVariable.fget_esinfo4vpnterminateOutputCollection/db:fget_esinfo4vpnterminateOutputCollection/db:fget_esinfo4vpnterminateOutput"/>
<xsl:for-each select="$dbout">
<xsl:if test="concat('00999', substring-before(substring(./db:USERID, 2.0), '/'), substring-after(./db:USERID, '/')) = $foo">
<profileCode>
<xsl:value-of select="./db:OLD_PID"/>
</profileCode>
</xsl:if>
</xsl:for-each>