IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Dealing with xs:duration in XQuery

  • 1.  Dealing with xs:duration in XQuery

    Posted Tue May 18, 2004 08:19 PM

    Hello everyone,

    This is a rather simple question, but I am not sure how to deal with it.

    I have an attribute called “interval” for one of my elements and it is of type xs:duration.
    This type is perfect for what I need to do with it.

    I can insert something like this as a value: “P2D” (which means duration of 2 days).
    When I check in Xplorer, it is stored as “P2D”.

    However, when I retrieve it with XQuery, I get this back: interval=“P0Y0M2DT0H0M0.0S”

    The Xquery appends and prepends the “missing” components of the duration with their values being 0.

    One of my applications expect a numerical value, since it doesn’t understand schema types. Is there a way in XQuery to strip away the characters if one knows the value will be days only, for example?

    Thank you,

    Peter Endisch

    ---------------------------------------
    I’m a Zen Garden Maintenance Engineer
    ---------------------------------------


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: Dealing with xs:duration in XQuery

    Posted Wed May 19, 2004 12:22 PM

    Hello,
    in 4.2 Tamino XQuery supports some substring
    functions, which you can use for that purpose,
    e.g.

    declare namespace xs = “XML Schema
    substring-before( string (xs:duration(“P2D”)), “T” )

    Best regards
    Walter


    #webMethods
    #API-Management
    #Tamino