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
Postnext
Neal  WaltersSubject: Xquery to find sample data file for testing
Author: Neal Walters
Date: 29 Jun 2005 10:42 AM
In a previous post entitled "XQuery on all XML Files in a Directory?",<br> Ivan helped me use Xquery to read all files in a directory. <br> <br> Today, I'm tring to find a sample Amazon order that has more one line line item. The following code works, but I have two questions: <br> <br> declare namespace ext = "FileUtils";<br> declare function ext:listFiles($path as xs:string) as xs:string* external;<br> declare variable $dirname as xs:string := "file:///c:/Odimo/Amazon/FileDrop/WorldOfWatches/Order__89/Doc_Original_Backup/";<br> <OrderReport><br> {<br> for $filename in fn:tokenize(ext:listFiles($dirname), ",")<br> [fn:matches(., ".xml")]<br> , $rootel in doc(fn:concat($dirname, "/", $filename))<br> return<br> <filename name='{$filename}'><br> <OrderID>{$rootel//Message/OrderReport/AmazonOrderID}</OrderID><br> <ItemCount>{count($rootel//Message/OrderReport/Item)}</ItemCount><br> </filename><br> }<br> </OrderReport><br> <br> Question 1: <br> Is there a way to limit the output to only those files (orders) that have a count >= 2 {count($rootel//Message/OrderReport/Item)? <br> <br> Question 2: <br> if I don't put two slashes here: <br> <OrderID>{$rootel//Message/OrderReport/AmazonOrderID}</OrderID> <br> I don't get anything. Why doesn't one slash work between $rootel and Message? From Stylus Studio, I can open a source doc, go to tree view, <br> and generate the following xpath: <br> /AmazonEnvelope/Message[1]/OrderReport[1]/AmazonOrderID[1] <br> <br> Thanks! <br> Neal Walters <br> <a href="http://Biztalk-Training.com">http://Biztalk-Training.com</a> <br> <br> <br> <br> <br>

Postnext
Neal  WaltersSubject: Xquery to find sample data file for testing
Author: Neal Walters
Date: 29 Jun 2005 10:47 AM
Wow - I clicked on "Edit" to change a typo in the previous message,
and it totally destroyed the format of my message. That was a shock? Are there tricks to watch out for when using "Edit" in the forum?

Sorry - perfectly spelled words have their cost.
Neal

Postnext
Alberto MassariSubject: Xquery to find sample data file for testing
Author: Alberto Massari
Date: 29 Jun 2005 10:51 AM
Hi Neal,
unfortunately the board software has problems editing a message (it converts the newlines into <br>). As for the question you are asking, I answered it in the original thread a couple of days ago (see http://www.stylusstudio.com/SSDN/default.asp?action=9&read=3819&fid=57)

Alberto

Posttop
Neal  WaltersSubject: Xquery to find sample data file for testing
Author: Neal Walters
Date: 29 Jun 2005 11:19 AM
Wow - I clicked on "Edit" to change a typo in the previous message,
and it totally destroyed the format of my message. That was a shock? Are there tricks to watch out for when using "Edit" in the forum?

Sorry - perfectly spelled words have their cost.
Neal

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