以下是我输入的xml:
<?xml version="1.0" encoding="UTF-8"?>
<Sample>
<CDGCreateTree>
<DST>
<currentJobName>PQContactComplete</currentJobName>
<AWD>
<case>
<CKEY>2016-03-28-04.21.07.535120T01</CKEY>
<transaction>
<businessArea>CS2XAA</businessArea>
<type>ISSUE</type>
<status>CREATED</status>
<worklist>false</worklist>
<recordType>T</recordType>
<CFLG>2</CFLG>
<OUID>DT77214</OUID>
<SBJT>Member</SBJT>
<ITYP>MS Care1st Member</ITYP>
<ICT1>Demographic Change</ICT1>
<ICT2 />
<ICT3 />
<ICT4 />
<ICT5 />
<STRT>2016-03-28-14.52.37.000000</STRT>
<STPT>2016-03-28-14.53.00.000000</STPT>
<RCAL>CREATED</RCAL>
<RGRP>KISHG2D2</RGRP>
<RATH />
<RMEM>KKMTEST3000</RMEM>
<RPRV />
<RCLM />
<RTYP />
<MLOB>KISHG2</MLOB>
<UIID>20160328-145300-DT77214</UIID>
<CBDS />
<CEDS />
<ABDS />
<AEDS />
<FDID>KKMTEST3000</FDID>
<comments>%0D%0AMS%20Care1st%20Member%20-%20Demographic%20Change</comments>
</transaction>
</case>
<case>
<CKEY>2016-03-28-04.22.36.512120T01</CKEY>
<transaction>
<businessArea>CS2XAA</businessArea>
<type>ISSUE</type>
<status>CREATED</status>
<worklist>false</worklist>
<recordType>T</recordType>
<CFLG>2</CFLG>
<OUID>DT77214</OUID>
<SBJT>Member</SBJT>
<ITYP>MS Correspondence</ITYP>
<ICT1>Adoption</ICT1>
<ICT2>Guardianship</ICT2>
<ICT3 />
<ICT4 />
<ICT5 />
<STRT>2016-03-28-14.53.00.000000</STRT>
<STPT>2016-03-28-14.53.25.000000</STPT>
<RCAL>CREATED</RCAL>
<RGRP>KISHG2D2</RGRP>
<RATH />
<RMEM>KKMTEST1300</RMEM>
<RPRV />
<RCLM />
<RTYP>PCP</RTYP>
<MLOB>KISHG2</MLOB>
<UIID>20160328-145325-DT77214</UIID>
<CBDS />
<CEDS />
<ABDS />
<AEDS />
<FDID>KKMTEST1300</FDID>
<comments>%0D%0AMS%20Correspondence%20-%20Adoption%0D%0AMS%20Correspondence%20-%20Guardianship</comments>
</transaction>
</case>
</AWD>
</DST>
</CDGCreateTree>
<CDGCreateTreeRequest>
<newNode>
<transaction relate="Y" id="2016-03-28-04.23.55.910120T01">
<id>2016-03-28-04.23.55.910120T01</id>
<createTime time="Y">2016-03-28T04:23:55:910120-05:00</createTime>
<permission>Update</permission>
<businessArea>CS2XAA</businessArea>
<type>ISSUE</type>
<workStep status="TOVBR">VBR Labeling</workStep>
<status>TOVBR</status>
<queue>SYSTEM</queue>
<priority>999</priority>
<priorityIncrease>0</priorityIncrease>
<VIP>N</VIP>
<assignedTo>SYSTEM</assignedTo>
<lockedBy>SYSTEM</lockedBy>
<amount>0.0000</amount>
<amountType />
<suspended>N</suspended>
<process>Y</process>
<customScreen>WRKXMPL</customScreen>
<iconName />
<MLOB>KISHG2</MLOB>
<STRT>2016-03-28-14.52.37.000000</STRT>
<RMEM>KKMTEST3000</RMEM>
<OUID>DT77214</OUID>
<STPT>2016-03-28-14.53.00.000000</STPT>
<FDID>KKMTEST3000</FDID>
<ITYP>MS Care1st Member</ITYP>
<ICT1>Demographic Change</ICT1>
<RGRP>KISHG2D2</RGRP>
<UIID>20160328-145300-DT77214</UIID>
<SBJT>Member</SBJT>
<RCAL>CREATED</RCAL>
<CFLG>2</CFLG>
<externalSystem>
<host />
<executable />
<parameters />
<procedure />
</externalSystem>
<commentsExist>Y</commentsExist>
</transaction>
</newNode>
</CDGCreateTreeRequest>
</Sample>
我的要求是验证//Sample/CDGCreateTreeRequest/newNode/transaction/UIID
值是否与案例//transaction/UIID
下列出的事务节点的//Sample/CDGCreateTree/DST/AWD/case
值匹配。如果是,请使用transaction
transaction
//Sample/CDGCreateTreeRequest/newNode/transaction
结果xml应如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<Sample>
<CDGCreateTree>
<DST>
<currentJobName>PQContactComplete</currentJobName>
<AWD>
<case>
<CKEY>2016-03-28-04.21.07.535120T01</CKEY>
<transaction relate="Y" id="2016-03-28-04.23.55.910120T01">
<id>2016-03-28-04.23.55.910120T01</id>
<createTime time="Y">2016-03-28T04:23:55:910120-05:00</createTime>
<permission>Update</permission>
<businessArea>CS2XAA</businessArea>
<type>ISSUE</type>
<workStep status="TOVBR">VBR Labeling</workStep>
<status>TOVBR</status>
<queue>SYSTEM</queue>
<priority>999</priority>
<priorityIncrease>0</priorityIncrease>
<VIP>N</VIP>
<assignedTo>SYSTEM</assignedTo>
<lockedBy>SYSTEM</lockedBy>
<amount>0.0000</amount>
<amountType />
<suspended>N</suspended>
<process>Y</process>
<customScreen>WRKXMPL</customScreen>
<iconName />
<MLOB>KISHG2</MLOB>
<STRT>2016-03-28-14.52.37.000000</STRT>
<RMEM>KKMTEST3000</RMEM>
<OUID>DT77214</OUID>
<STPT>2016-03-28-14.53.00.000000</STPT>
<FDID>KKMTEST3000</FDID>
<ITYP>MS Care1st Member</ITYP>
<ICT1>Demographic Change</ICT1>
<RGRP>KISHG2D2</RGRP>
<UIID>20160328-145300-DT77214</UIID>
<SBJT>Member</SBJT>
<RCAL>CREATED</RCAL>
<CFLG>2</CFLG>
<externalSystem>
<host />
<executable />
<parameters />
<procedure />
</externalSystem>
<commentsExist>Y</commentsExist>
</transaction>
</case>
<case>
<CKEY>2016-03-28-04.22.36.512120T01</CKEY>
<transaction>
<businessArea>CS2XAA</businessArea>
<type>ISSUE</type>
<status>CREATED</status>
<worklist>false</worklist>
<recordType>T</recordType>
<CFLG>2</CFLG>
<OUID>DT77214</OUID>
<SBJT>Member</SBJT>
<ITYP>MS Correspondence</ITYP>
<ICT1>Adoption</ICT1>
<ICT2>Guardianship</ICT2>
<ICT3 />
<ICT4 />
<ICT5 />
<STRT>2016-03-28-14.53.00.000000</STRT>
<STPT>2016-03-28-14.53.25.000000</STPT>
<RCAL>CREATED</RCAL>
<RGRP>KISHG2D2</RGRP>
<RATH />
<RMEM>KKMTEST1300</RMEM>
<RPRV />
<RCLM />
<RTYP>PCP</RTYP>
<MLOB>KISHG2</MLOB>
<UIID>20160328-145325-DT77214</UIID>
<CBDS />
<CEDS />
<ABDS />
<AEDS />
<FDID>KKMTEST1300</FDID>
<comments>%0D%0AMS%20Correspondence%20-%20Adoption%0D%0AMS%20Correspondence%20-%20Guardianship</comments>
</transaction>
</case>
</AWD>
</DST>
</CDGCreateTree>
<CDGCreateTreeRequest>
<newNode>
<transaction relate="Y" id="2016-03-28-04.23.55.910120T01">
<id>2016-03-28-04.23.55.910120T01</id>
<createTime time="Y">2016-03-28T04:23:55:910120-05:00</createTime>
<permission>Update</permission>
<businessArea>CS2XAA</businessArea>
<type>ISSUE</type>
<workStep status="TOVBR">VBR Labeling</workStep>
<status>TOVBR</status>
<queue>SYSTEM</queue>
<priority>999</priority>
<priorityIncrease>0</priorityIncrease>
<VIP>N</VIP>
<assignedTo>SYSTEM</assignedTo>
<lockedBy>SYSTEM</lockedBy>
<amount>0.0000</amount>
<amountType />
<suspended>N</suspended>
<process>Y</process>
<customScreen>WRKXMPL</customScreen>
<iconName />
<MLOB>KISHG2</MLOB>
<STRT>2016-03-28-14.52.37.000000</STRT>
<RMEM>KKMTEST3000</RMEM>
<OUID>DT77214</OUID>
<STPT>2016-03-28-14.53.00.000000</STPT>
<FDID>KKMTEST3000</FDID>
<ITYP>MS Care1st Member</ITYP>
<ICT1>Demographic Change</ICT1>
<RGRP>KISHG2D2</RGRP>
<UIID>20160328-145300-DT77214</UIID>
<SBJT>Member</SBJT>
<RCAL>CREATED</RCAL>
<CFLG>2</CFLG>
<externalSystem>
<host />
<executable />
<parameters />
<procedure />
</externalSystem>
<commentsExist>Y</commentsExist>
</transaction>
</newNode>
</CDGCreateTreeRequest>
</Sample>
如果您需要任何其他信息,请与我们联系。
答案 0 :(得分:1)
查看 XSL身份转换,例如this。
并添加spezial模板。你可以尝试这样的事情:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="AWD/case/transaction">
<xsl:variable name="this" select="."/>
<xsl:variable name="new" select="//CDGCreateTreeRequest/newNode/transaction[UIID = $this/UIID]"/>
<xsl:choose>
<xsl:when test ="count($new) > 0">
<xsl:copy-of select="$new" />
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>