Project

Profile

Help

Tuples and maps in xslt 2.0/xquery 1.0

Added by Anonymous about 16 years ago

Legacy ID: #4886959 Legacy Poster: Vladimir Nesterovsky (vnesterovsky)

Hello Mr. Kay! Did you or xslt/xquery WG consider introduction of: tuples - something like opaque sequences, and maps - associative containers? I think these set based constructs fits naturally into xslt/xquery. Please do not think I just want to put my links on this page, but I rather want to refer to my view of tuple and map: "http://www.nesterovsky-bros.com/weblog/PermaLink,guid,64010d0a-cc81-4fbb-a286-bb199ac7d911.aspx" "http://www.nesterovsky-bros.com/weblog/PermaLink,guid,55a17359-e2ae-4a7e-8249-92e8266970e2.aspx"


Replies (3)

Please register to reply

RE: Tuples and maps in xslt 2.0/xquery 1.0 - Added by Anonymous about 16 years ago

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

There was a significant push to try and get "sequences of sequences" into the XQuery 1.0 data model and type system, but the WG as a whole felt that it was a step too far. If it had succeeded, it could have formed the basis for some of the features you describe. The requirements list for XQuery 1.1 mentions "references to nodes" as a requirement; I don't know what will come of this, but I think it's another attempt to get more powerful data structures into the model. I certainly agree there are cases where more powerful collections and maps could be useful. The challenge is to do this in a way that is XML-friendly, that recognizes that the primary purpose of these languages is to process XML. If you have ideas, please submit them to the WG - there's not much point in doing it here.

RE: Tuples and maps in xslt 2.0/xquery 1.0 - Added by Anonymous almost 16 years ago

Legacy ID: #4969979 Legacy Poster: Vladimir Nesterovsky (vnesterovsky)

I've implemened tuple and map approximation for Saxon as java extension functions. Sources can be found at: http://www.nesterovsky-bros.com/weblog/2008/05/18/TuplesAndMapsInSaxon.aspx I suspect however that a performance of such implementation is far from perfect, as tuples and maps may be used very often (almost as often as sequences), and reflection layer bites here. Is it possible to attach extension functions in more efficient way, or even integrate this or similar api into Saxon? Thanks.

RE: Tuples and maps in xslt 2.0/xquery 1.0 - Added by Anonymous almost 16 years ago

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

It's possible in principle to integrate extension functions more deeply into Saxon by writing your own Extension Function binding mechanism - see Configuration.setExtensionBinder(). (At present you can only replace the way that java: URIs are handled, you can't implement support for other URI schemes; the interface is designed to make this possible in future.) Basically if you subclass JavaExtensionLibrary then you can intercept calls on bind() at compile time and bind the function call to your own Expression object which is then called in the same way as built-in expressions. However, it's a lot of work and I don't think I would recommend it - nearly all the Saxon-supplied extension functions are implemented using the standard reflection approach.

    (1-3/3)

    Please register to reply