Java Objects in Result trees
Added by Anonymous about 20 years ago
Legacy ID: #2834222 Legacy Poster: Gunther Schadow (gschadow)
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
Replies (1)
RE: Java Objects in Result trees - Added by Anonymous about 20 years ago
Legacy ID: #2834361 Legacy Poster: Michael Kay (mhkay)
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
Please register to reply