XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Philip YoungSubject: XQuery equivalent of xsl:result-document
Author: Philip Young
Date: 12 Jun 2007 03:01 PM
As a way to learn more about XQuery I'm converting an XSL 2.0 stylesheet by hand. I've found equivalent constructs for everything except the following:
<xsl:result-document href="{concat('../txt/',$filename, '-test.txt')}">

where the point of the href is to construct a filename for the output of the stylesheet. The $filename variable is taken from the base-uri of the input XML file.

How can I do this in XQuery?

Minollo I.Subject: XQuery equivalent of xsl:result-document
Author: Minollo I.
Date: 12 Jun 2007 03:17 PM
You can't do that directly from XQuery; I can think of two options:
- You create a Java extension function responsible for saving to file a specific XML fragment (that you could serialize to a string using ddtek:serialize() if you are using DataDirect XQuery)
- You make the XQuery return a sequence of XML fragments (rather than a single node), which then you serialize to disk as part of the Java code used to consume the XQuery result

If you indicate a preference for one solution or the other, I can sketch out an example working with DataDirect XQuery to show you how that would work in practice.

Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.