Xml 打印状态为&x27的最新日期;进行中';在XSLT代码中
下面是XML-Xml 打印状态为&x27的最新日期;进行中';在XSLT代码中,xml,xslt,Xml,Xslt,下面是XML- <?xml version='1.0' encoding='UTF-8'?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Body> <wd:Get_Program_of_Study_Assignment_Snapshots_Response xmlns:wd=&quo
<?xml version='1.0' encoding='UTF-8'?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<wd:Get_Program_of_Study_Assignment_Snapshots_Response
xmlns:wd="urn:com.workday/bsvc"
wd:version="v35.0">
<wd:Response_Data>
<wd:Program_of_Study_Assignment_Snapshot_Data>
<wd:Order>a</wd:Order>
<wd:Effective_Date>2013-08-17</wd:Effective_Date>
<wd:Program_of_Study_Record_Status_Reference>
<wd:ID wd:type="Student_Program_of_Study_Record_Status_ID">MATRICULATED</wd:ID>
</wd:Program_of_Study_Record_Status_Reference>
</wd:Program_of_Study_Assignment_Snapshot_Data>
<wd:Program_of_Study_Assignment_Snapshot_Data>
<wd:Order>c</wd:Order>
<wd:Effective_Date>2013-06-17</wd:Effective_Date>
<wd:Program_of_Study_Assignment_Snapshot_Subedit_Data>
<wd:Program_of_Study_Record_Status_Reference>
<wd:ID wd:type="Student_Program_of_Study_Record_Status_ID">IN_PROGRESS</wd:ID>
</wd:Program_of_Study_Record_Status_Reference>
</wd:Program_of_Study_Assignment_Snapshot_Subedit_Data>
</wd:Program_of_Study_Assignment_Snapshot_Data>
<wd:Program_of_Study_Assignment_Snapshot_Data>
<wd:Order>b</wd:Order>
<wd:Effective_Date>2019-09-19</wd:Effective_Date>
<wd:Program_of_Study_Assignment_Snapshot_Subedit_Data>
<wd:Program_of_Study_Record_Status_Reference>
<wd:ID wd:type="Student_Program_of_Study_Record_Status_ID">IN_PROGRESS</wd:ID>
</wd:Program_of_Study_Record_Status_Reference>
</wd:Program_of_Study_Assignment_Snapshot_Subedit_Data>
</wd:Program_of_Study_Assignment_Snapshot_Data>
<wd:Program_of_Study_Assignment_Snapshot_Data>
<wd:Order>d</wd:Order>
<wd:Effective_Date>2020-09-14</wd:Effective_Date>
<wd:Program_of_Study_Assignment_Snapshot_Subedit_Data>
<wd:Program_of_Study_Record_Status_Reference>
<wd:ID wd:type="Student_Program_of_Study_Record_Status_ID">COMPLETE</wd:ID>
</wd:Program_of_Study_Record_Status_Reference>
</wd:Program_of_Study_Assignment_Snapshot_Subedit_Data>
</wd:Program_of_Study_Assignment_Snapshot_Data>
</wd:Response_Data>
</wd:Get_Program_of_Study_Assignment_Snapshots_Response>
</env:Body>
</env:Envelope>
A.
2013-08-17
录取
C
2013-06-17
进行中
B
2019-09-19
进行中
D
2020-09-14
完成
下面是我打印最新生效日期的XSLT,其中状态为“正在进行”,但这段代码没有给我任何数据-
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wd="urn:com.workday/bsvc"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
>
<xsl:template match="/">
<File>
<xsl:variable name="MatriculationDate">
<xsl:for-each select="env:Envelope/env:Body/wd:Get_Program_of_Study_Assignment_Snapshots_Response/wd:Response_Data/
wd:Program_of_Study_Assignment_Snapshot_Data">
<xsl:sort select="wd:Effective_Date" order="descending"/>
<xsl:choose>
<xsl:when
test="contains(wd:Program_of_Study_Assignment_Snapshot_Data/wd:Program_of_Study_Record_Status_Reference/
wd:ID [@wd:type = 'Student_Program_of_Study_Record_Status_ID'], 'IN_PROGRESS')">
<xsl:if test="position() = 1">
<xsl:value-of select="wd:Effective_Date"/>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<data>
<m>
<xsl:value-of select="$MatriculationDate" />
</m>
</data>
</File>
</xsl:template>
</xsl:stylesheet>
我想打印最新的生效日期(在xml“2019-09-19”中),其中状态为“正在进行”。
任何人都可以帮助我使用这个XSLT代码吗
谢谢你的时间和努力
打印状态为“正在进行”的最新生效日期
这可能如下所示:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wd="urn:com.workday/bsvc"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
exclude-result-prefixes="wd env"
>
<xsl:output indent="yes" />
<xsl:template match="/">
<File>
<data>
<m>
<xsl:for-each select="//wd:Program_of_Study_Assignment_Snapshot_Data[
.//wd:ID[@wd:type = 'Student_Program_of_Study_Record_Status_ID'] = 'IN_PROGRESS'
]">
<xsl:sort select="wd:Effective_Date" order="descending" />
<xsl:if test="position() = 1">
<xsl:value-of select="wd:Effective_Date" />
</xsl:if>
</xsl:for-each>
</m>
</data>
</File>
</xsl:template>
</xsl:stylesheet>
输出:
<File>
<data>
<m>2019-09-19</m>
</data>
</File>
2019-09-19