xslt 或 xquery 在当前时间上添加分钟

问题描述 投票:0回答:1

我想创建一个安全标头,如下所示:

 <soapenv:Header>
  <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd>
     <wsu:Timestamp wsu:Id="TS-E157FC3B34ADB1C4DF16976549459948">
        <wsu:Created>2023-10-18T18:49:05.994Z</wsu:Created>
        <wsu:Expires>2023-10-18T18:50:05.994Z</wsu:Expires>
     </wsu:Timestamp>
  </wsse:Security>

对于

<wsu:Created>2023-10-18T18:49:05.994Z</wsu:Created>  
我想要当前日期时间并且
 <wsu:Expires>  </wsu:Expires> has to be 1 min more than current time
xslt 1.0 中是否有任何函数可以用来获取当前日期时间并比它多 1 分钟或在 xquery 中

xslt xslt-1.0 xquery
1个回答
0
投票

这在 XSLT 1.0 中实现起来很困难,但在 XSLT 2.0 或 XQuery 1.0(共享相同的函数库)中却很容易。简直就是

current-dateTime() + xs:dayTimeDuration('PT1M')
© www.soinside.com 2019 - 2024. All rights reserved.