基于XSLT中的条件连接节点值

时间:2015-08-21 06:48:21

标签: xml xslt

我有以下xml。

EMPLOYEE_DEPARTMENTS

首先,我需要检查<?xml version="1.0" encoding="UTF-8"?> <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP:Body> <response:performJobResponse xmlns:response="http://tempuri.org/" SOAP:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <whiteboard> <PQ> <response> <PQIssueHistory> <AWD10SP7_1orhigher>Y</AWD10SP7_1orhigher> <hostAddress>10.193.XXX.78</hostAddress> <hostPort>12955</hostPort> <userID>7X606</userID> <password>Qfgjf@123</password> <issue> <CRDATTIM>2015-07-29-04.27.15.461040</CRDATTIM> <RECORDCD>T</RECORDCD> <CRNODE>01</CRNODE> <ORIGUSERID>DT77214</ORIGUSERID> </issue> </PQIssueHistory> <results> <row> <RECTYP>HISTORY</RECTYP> </row> <row> <date>2015-08-18</date> <time>04:04:58-05:00</time> </row> </results> </response> </PQ> </whiteboard> <jobReturn> <taskName>TransformNode</taskName> <description>TransformNode Succeeded</description> <value>0</value> </jobReturn> </response:performJobResponse> </SOAP:Body> </SOAP:Envelope> 是否有<row><date>,如果有,我应该连接<time>和{{1}的值并将新生成的值分配给新标记<date>

例如:<time>

最终结果xml应如下所示:

<CRDATTIM> </CRDATTIM>

1 个答案:

答案 0 :(得分:1)

  

在验证<date><time>是否存在时遇到问题   <row>或不。{/ p>

编写与所需行匹配的模板:

<xsl:template match="row[date and time]">

并将处理代码放入其中。