math - How do you convert an XSLT 2.0 date duration to a string? -
I am using XSLT 2.0 using a few code subtracting from one date to another:
& lt; Xsl: Template Match = "Leaving End" & gt; & Lt; Xsl: Select the value = "current-date () - xs: date (.)" / & Gt; & Lt; / XSL: Templates & gt;
This works, but it leaves me with the answer to P2243D, which I believe is "2243 days duration" Correct mathematics in context).
Since I only need a number of days, not P and D, I know that I can use substrings or something similar, but as a newbie to XSLT, I'm curious If there is a better and more excellent way to manipulate this simple string there.
You just FN: day-to-day ()
one < To get the duration in the form of code> xs: integer :
From day to day ($ Arg as xs: duration?)
Asxs: integer?
returns a
xs: integer
that represents the component of the day in the canon, the literal representation of the value of$ arg
is negative Could.
See the specification for more information.
In your case:
& lt; Xsl: template match = "moveInDate" & gt; & Lt; Xsl: Select the value = "day-to-date (current-date () - xs: date (.))" / & Gt; & Lt; / XSL: Templates & gt;
Hope it helps!
EDIT: You can say that with option processing but as you say, it is not like if you want to do something for some reason, then think about data types needed. As a result of current-date () - xs: date (.)
as a result of xs: duration
, which can be processed without caste based on neglected works Are:
& lt; Xsl: select value = "sub-place (after sub-($ dur, 'P'), 'D')" /> & Lt; / XSL: Templates & gt;
Comments
Post a Comment