Re: [Xsltforms-support] xsd:duration types
Brought to you by:
alain-couthures
From: Alain C. <ala...@ag...> - 2016-06-29 17:25:00
|
Hello Habs, Sorry for the delay. I suggest you to write a Javascript function to be called from an XPath expression as in http://www.agencexml.com/xsltforms/colors.xml --Alain Le 19/06/2016 à 09:01, bc...@sh... a écrit : > Thank you for the reply Alain. > > It will be interesting times when 'fleur' and XSLTForms 2 arrive. :-) > > For now, as I said, I am wanting to generate a xsd:duration content > based on a start and end xsd:date and xsd:time elements entered via a > xform. > > I have not got far enough yet to submit a working xform test case > skeleton, as I am just trying to sort out the best way to generate the > xsd:duration, however for instance: > > ... > <datestart>20160510</datestart> > <timestart>083000</timestart> > <dateend>20160511</dateend> > <timeend>104500</timeend> > <duration>PT26H15M</duration> <------- calculate this, a > duration showing hours and minutes, from the date and time elements > ... > > What would be the best and/or efficient approach please? > > At the moment I am intending to use xf:bind calculations, using > substring, floor and div functions etc on the date and time > elements, to *eventually* get the desired content for the > xsd:duration element. Perhaps there is a better approach ? > > As an aside, if I have understood it properly, the EXSLT template > 'date:duration' provides this process, so perhaps it is possible to do > a xslt transform within XSLTForms to produce the desired duration > instance. > > > I will keep on it and see what I come up with, but if you (or any one > else) have any ideas/tips please let me know. > > Regards > Habs > > > On 18 June 2016 at 21:06, Alain Couthures > <ala...@ag... <mailto:ala...@ag...>> > wrote: > > Hello Habs, > > I am currently extending my new XPath engine (Fleur) into an > XQuery engine as well. Progressively, it will support XPath/XQuery > 3.1 but there are still missing functionalities such as durations. > Because of functions such as doc(), this engine is written in > asynchronous Javascript so it will not be possible to use it > within XSLTForms v1 but within XSLTForms v2. > > Priorities are always hard to decide. Adding duration support in > XSLTForms v1 might reduce time required for adding it in Fleur... > > Maybe you don't need a full support yet? Can you post a test case?? > > --Alain > > > Le 18/06/2016 à 21:15, bc...@sh... > <mailto:bc...@sh...> a écrit : >> Hello all, good day >> >> Most likely this has been mentioned before and if so my apologies >> for not finding anything on it by better searching 'discussion' >> or mailing lists. >> >> How easy (technically and time availability) would it be for >> maintainers (Alain ?) to implement the xsd:duration type and >> associated functions (I think they are XPath 2) ? >> >> For now, would some kind person assist (post a small code >> perhaps) by suggesting how to best/efficiently process xsd:time >> elements 'time-from' and 'time-to' in a repeat block, such that >> for each pair the duration in minutes (seconds does not matter) >> is calculated and then a total for the nodeset ? >> >> For now, as a descriptive, I am playing with implementing a >> <minutes/> element for each repeat item and using a 'bind >> calculate' to get the value by string splitting and using math >> functions to obtain the duration hours (converting it to minutes) >> and minutes and adding the two. >> >> Then to create a <totalminutes/> element and using a 'bind >> calculate' to get the value by using sum() on the <minutes/> nodeset. >> >> >> Thank you for some info and comments. >> Peace and best wishes >> >> Habs >> >> >> >> ------------------------------------------------------------------------------ >> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic >> patterns at an interface-level. Reveals which users, apps, and protocols are >> consuming the most bandwidth. Provides multi-vendor support for NetFlow, >> J-Flow, sFlow and other flows. Make informed decisions using capacity planning >> reports.http://sdm.link/zohomanageengine >> >> >> _______________________________________________ >> Xsltforms-support mailing list >> Xsl...@li... >> <mailto:Xsl...@li...> >> https://lists.sourceforge.net/lists/listinfo/xsltforms-support > > > |