Project

Profile

Help

Maintenance. Planio will be undergoing a scheduled maintenance this weekend. Between Saturday, July 24 at 9:00 UTC and Sunday, July 25, 22:00 UTC your account might observe occasional downtimes which may last up to several minutes in some cases.

Is Gizmo restricted to the pre XSLT 3 world with XML documents as input and output, without supporting XDM maps or array or sequences of items in general as (intermediary) results of commands?

Added by Martin Honnen over 1 year ago

As XSLT 3 and XQuery 3.1 support more than XML to XML processing I was wondering whether there is any way in Gizmo or any support planned to allow other XDM values like maps, arrays, sequences of items as results or intermediary results of commands.


Replies (3)

Please register to reply

RE: Is Gizmo restricted to the pre XSLT 3 world with XML documents as input and output, without supporting XDM maps or array or sequences of items in general as (intermediary) results of commands? - Added by Michael Kay over 1 year ago

You can bind the result of any XPath expression to a variable using the "set" command. But the transform command is currently very simple, for example there's no mechanism to supply parameters. We'll need to think carefully about how to provide extra functionality without the interface becoming over-complex -- it's intended as a tool for doing simple things without programming and I don't want to invent a new transformation language.

RE: Is Gizmo restricted to the pre XSLT 3 world with XML documents as input and output, without supporting XDM maps or array or sequences of items in general as (intermediary) results of commands? - Added by Martin Honnen over 1 year ago

You can bind the result of any XPath expression to a variable using the "set" command

I don't get very far in using such a variable with non-XML values e.g.

Saxon Gizmo 10.0
/>set json1 = parse-json('{ "name" : "foo", "values" : [1,2,3] }')

/>show $json1?values
Exception in thread "main" java.lang.UnsupportedOperationException: An array does not have a string value
        at net.sf.saxon.ma.arrays.AbstractArrayItem.getStringValue(AbstractArrayItem.java:217)
        at net.sf.saxon.Gizmo.show(Gizmo.java:842)
        at net.sf.saxon.Gizmo.executeCommands(Gizmo.java:309)
        at net.sf.saxon.Gizmo.<init>(Gizmo.java:236)
        at net.sf.saxon.Gizmo.main(Gizmo.java:167)

Even the json-to-xml way seems blocked:

/>set .= json-to-xml('{ "name" : "foo", "values" : [1,2,3] }')
Exception in thread "main" java.lang.ClassCastException: net.sf.saxon.tree.tiny.TinyDocumentImpl cannot be cast to net.sf.saxon.tree.linked.DocumentImpl
        at net.sf.saxon.Gizmo.set(Gizmo.java:780)
        at net.sf.saxon.Gizmo.executeCommands(Gizmo.java:309)
        at net.sf.saxon.Gizmo.<init>(Gizmo.java:236)
        at net.sf.saxon.Gizmo.main(Gizmo.java:167)

In the interactive mode it might be easier to explore the commands if such exceptions like above would be caught and the tool would continue to run instead of exiting due to the exception, otherwise it is a bit tedious to get back to the state of variables before the exception.

RE: Is Gizmo restricted to the pre XSLT 3 world with XML documents as input and output, without supporting XDM maps or array or sequences of items in general as (intermediary) results of commands? - Added by Michael Kay over 1 year ago

Added these to bug #4488.

Yes, I've hit the problem myself that some dynamic errors cause Gizmo to quit rather than recovering at the command level as it is supposed to.

    (1-3/3)

    Please register to reply