Waq*_*zaq 3 xml xslt xpath xslt-2.0
我有一个场景,我们需要在现有日期中增加 1 天。就像在<subscriptionDate>2015-05-06</subscriptionDate>我想增加 1 天并将其值映射到 <terminationDate>2015-05-07</terminationDate>. 我如何使用 XSLT 实现这一点。因此,还应处理所有日期限制。就像如果天是 31 则以月为单位递增。
<Subscription code="12345678R1">
<userAccount>40000005b</userAccount>
<offerTemplate>Test</offerTemplate>
<subscriptionDate>2015-05-06</subscriptionDate>
<terminationDate></terminationDate>
</Subscription>
Run Code Online (Sandbox Code Playgroud)
假设 XSLT 2.0 您可以为日期添加持续时间,例如
<xsl:template match="terminationDate">
<xsl:copy>
<xsl:value-of select="xs:date(preceding-sibling::subscriptionDate) + xs:dayTimeDuration('P1D')"/>
</xsl:copy>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
请参阅http://xsltransform.net/pPqsHTP。
| 归档时间: |
|
| 查看次数: |
15396 次 |
| 最近记录: |