【发布时间】:2016-04-27 21:44:29
【问题描述】:
使用我的 xml 文档,我想在输出中显示受访者的姓名。
这是条件
当当前状态 <TimestampCreate>element 的日期和时间早于 2016 年 3 月 24 日中午时,显示来自 Party/PartyName 元素的格式化名称。
否则当当前状态 <TimestampCreate> 的日期在 2016 年 3 月 24 日中午之后,显示来自 CaseParty/CasePartyName 元素的格式化名称。
我该怎么做?
我的 xml 文档
<Integration>
<Case>
<CaseParty ID="17154970" InternalCasePartyID="1636956553" InternalPartyID="1615052853">
<Connection Word="RSP" BaseConnection="DF" ID="39228182" InternalCasePartyConnectionID="1638740325">
<Description>Respondent</Description>
<TimestampCreate>4/27/2016 9:25:08 AM</TimestampCreate>
<DateAdded>04/27/2016</DateAdded>
</Connection>
<CasePartyName Current="true" ID="10737806" InternalNameID="1615969730">
<FormattedName>Tree, Walnut</FormattedName>
</CasePartyName>
<TimestampCreate>4/27/2016 9:25:08 AM</TimestampCreate>
</CaseParty>
<ProtectionOrders>
<ProtectionOrder Op="E" InternalProtectionOrderID="2408">
<Statuses>
<Status Op="A">
<Current>true</Current>
<Active>Yes</Active>
<Date Op="A">04/27/2016</Date>
<TimestampCreate Op="A">04/27/2016 12:01:58:963</TimestampCreate>
</Status>
</Statuses>
</ProtectionOrder>
</ProtectionOrders>
</Case>
<Party ID="17154970" InternalPartyID="1615052853">
<PartyName ID="10737806" Current="true" InternalNameID="1615969730">
<FormattedName>Nelson, Plince</FormattedName>
</Party>
</Integration>
我的 XSLT 代码
<xsl:for-each select="CasePartyName[@Current='true']">
<xsl:value-of select="FormattedName"/>
</xsl:for-each>
【问题讨论】: