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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
- XQuery Help and Discussion (2016)
-> - Issue with Processing Instruct... (1)
-> + problem converting json to XML... (2)
-> + Problem base64 decoding string... (3)
-> + Problems posting multipart for... (5)
-> + trouble with download of price... (2)
-> + Problem with http-post not bei... (3)
-> + path problem, xps_file:writeAl... (9)
-> + Xquery update support? (2)
-> + problem with Stylus studio try... (5)
-> + adding dtd reference to xml ou... (4)
-> + xquery escaping ambarsand when... (3)
-> + Whitespace problem when return... (5)
-> + Problem with namespace prefix ... (5)
-> - Sending via SFTP returns unexp... (1)
-> + Query and Sftp clent (4)
-> + xquery and try - catch (3)
-> + Query + ddtek:http-post optio... (5)
-> + Example files referenced in do... (3)
-> + Automatic Error Detection and ... (3)
-> + Working with result of ddtek:h... (2)
-- [1-20] [21-40] [41-60] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
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?

Posttop
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.

   
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!  
go

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.