Java Objects in Result trees

Help
2004-11-02
2012-10-08
  • Gunther Schadow

    Gunther Schadow - 2004-11-02

    Hi Michael,

    would it be possible to allow Java Objects as value in Result trees? I can have such Objects as values of variables or as members of sequences, but when I put them into an XML attribute, it gets converted to a string. However, I'd like to have those Objects in intermediate XML structures to process. Of course I understand that those Objects couldn't be output as Objects in the final result documents, but in intermediate documents they could be used.

    Examlple:

    <xsl:variable name="system-io" xmlns:sys="java:java.lang.System">
    <channel name="input" value="{sys:in()}"/>
    <channel name="output" value="{sys:out()}"/>
    <channel name="error" value="{sys:err()}"/>
    </xsl:variable>

    <xsl:variable name="blurb" xmlns:ps="java:java.io.PrintStream" select="ps:println($system-io[@name eq 'input],'Hello World')"/>

    thanks,
    -Gunther

     
    • Michael Kay

      Michael Kay - 2004-11-02

      The tree construction model in both XSLT and XQuery is that you can only get a typed value for an element or attribute by first constructing the string value and then putting it through validation. So I think your idea would significantly upset this model.

      As it happens, Saxon currently always stores the string value or a node plus the type annotation, rather than storing the typed value. That could be changed (and might change), but it doesn't alter the construction semantics.

      Michael Kay

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks