Project

Profile

Help

subtract-dayTimeDuration-from-date

Added by Anonymous almost 18 years ago

Legacy ID: #3792551 Legacy Poster: Jaran Nilsen (sfkarbo)

Hi. I want to use the op:subtract-dayTimeDuration-from-date method for getting the date of a number of days back in time. I have some problems getting this to work however and was wondering if it is at all implemented in Saxon? I was unable to find the function under "Index of Functions" in the Saxon documentation. Is the function not available (for use in XQuery) or have I simply done something wrong? What is the correct namespace URI for the op: namespace? Here is how I use the function: op:subtract-dayTimeDuration-from-date($today, xs:dayTimeDuration("P1D")) Regards, Jaran Nilsen


Replies (3)

Please register to reply

RE: subtract-dayTimeDuration-from-date - Added by Anonymous almost 18 years ago

Legacy ID: #3792607 Legacy Poster: Michael Kay (mhkay)

Functions prefixed "op:" are not real user-visible functions. They are in the spec to define the semantics of operators applied to the relevant argument types. In this case the operator in question is "-". The way you subtract a duration from a date is "$date - $dayTimeDuration". Michael Kay Saxonica

RE: subtract-dayTimeDuration-from-date - Added by Anonymous almost 18 years ago

Legacy ID: #3792672 Legacy Poster: Jaran Nilsen (sfkarbo)

Thanks for your quick answer. Now I will just have to go and beat myself for an hour... It was as simple as that and I spent hours trying to find the solution :) Perhaps you can help me on another issue as well? I used the solution you suggested above and it works well when I transform using the commandline: java net.sf.saxon.Query but when I try to transform with the same XQuery in my application I get the message: net.sf.saxon.trans.StaticError: XQuery static error in #...eDuration("-P1D") let $#: Unknown constructor function: {http://www.w3.org/2001/XMLSchema}dayTimeDuration In my application I use the Saxon 8.7 jar from the Maven repository (http://www.ibiblio.net/maven2/net/sf/saxon/saxon/8.7/) and on the command-line i use the 8.7.3 version downloaded from saxon.sf.net. Any idea what may be causing this problem? Is it a configuration error in my application?

RE: subtract-dayTimeDuration-from-date - Added by Anonymous almost 18 years ago

Legacy ID: #3792679 Legacy Poster: Jaran Nilsen (sfkarbo)

I see now that it is a problem with different versions. I will use the 8.7.3 jars instead and hopefully that will solve my problem in the application :) Regards, Jaran Nilsen

    (1-3/3)

    Please register to reply