xslt新手。这是输入的xml。
<Response>
<RecordNumber/>
<id>2014-12-24</id>
<person>
<gender>MALE</gender>
<genericLocations>
<effective>2012-11-28</effective>
</genericLocations>
<genericLocations>
<expiration>2012-11-27</expiration>
<effective>2008-12-09</effective>
</genericLocations>
<genericLocations>
<expiration>2008-12-08</expiration>
<effective>2006-01-13</effective>
</genericLocations>
<genericLocations>
<expiration>2006-01-12</expiration>
<effective>2001-07-17</effective>
</genericLocations>
<genericLocations>
<expiration>2001-07-16</expiration>
<effective>1901-01-01</effective>
</genericLocations>
</person>
</Response>以下是所需的输出XML:
<Response>
<RecordNumber/>
<id>2014-12-24</id>
<person>
<gender>MALE</gender>
<genericLocations>
<effective>2012-11-28</effective>
</genericLocations>
</person>
</Response>输出xml只需要包含一个"genericLocations“节点,该节点中的”empty“要么为空(或缺失),要么是将来的(大于今天的日期)。
任何帮助都是非常感谢的。
发布于 2016-08-18 15:25:43
假设XSLT2.0,您希望
<xsl:template match="person">
<xsl:copy-of select="gender,
genericLocations[not(xs:date(expiration) le current-date())][1]"/>
</xsl:template>再加上一个身份模板,可以原封不动地复制其他所有内容。
https://stackoverflow.com/questions/39009593
复制相似问题