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
Tony ZanellaSubject: Swapping elements using XQuery?
Author: Tony Zanella
Date: 06 Oct 2008 10:13 AM
Hello all,
I'm using the following XQuery to list all the "head" elements in a collection of xml files, nesting them in a "results" element:

<results>{for $x in collection("collection_list.xml")//head return ($x)}</results>

This goes into "collection_list.xml", which looks like:

<collection>
<doc href="/home/tony/Desktop/collections/18cent_c/18cent_c.01.xml"/>
<doc href="/home/tony/Desktop/collections/18cent_c/18cent_c.02.xml"/>
...
</collection>

and gives me a nice list of the head tags, which I name "results.xml":

<results>
<head>Note </head>
<head>Chapter VII </head>
<head>Title Page </head>
...
</results>

Then, I process "results.xml" with a regex to tag up roman numerals, like so, and save the file:

<results>
<head>Note </head>
<head>Chapter <roman_num>VII</roman_num> </head>
<head>Title Page </head>
...
</results>

Now, what I want to do is to swap out the "head" elements in the collection (18cent.01.xml, etc.), replacing them with the "head" elements in "results.xml".

Is this possible using XQuery? If so, how? If not, can you suggest another way of achieving this?

Thanks in advance for your help!
Tony Zanella


Posttop
Minollo I.Subject: Swapping elements using XQuery?
Author: Minollo I.
Date: 06 Oct 2008 10:57 AM
Looks like you are relying on a proprietary handling of the collection() function (http://www.saxonica.com/documentation/sourcedocs/collections.html). I would suggest that you ask the question to saxonica.com directly.

   
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.