Guest marcio Posted April 19, 2007 Share Posted April 19, 2007 Please !!As i execute one query (Xpath/XQuery) that it returns the name from the archives that will count category "WEB" ? book001.xml<?xml version="1.0" encoding="ISO-8859-1"?><book category="COOKING"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price></book>book002.xml<?xml version="1.0" encoding="ISO-8859-1"?><book category="CHILDREN"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price></book>book003.xml<?xml version="1.0" encoding="ISO-8859-1"?><book category="WEB"> <title lang="en">XQuery Kick Start</title> <author>James McGovern</author> <year>2003</year> <price>49.99</price></book>book004.xml<?xml version="1.0" encoding="ISO-8859-1"?><book category="WEB"> <title lang="en">Learning XML</title> <author>Erik T. Ray</author> <year>2003</year> <price>39.95</price></book> Link to comment Share on other sites More sharing options...
boen_robot Posted April 19, 2007 Share Posted April 19, 2007 What's that? You're asking how to count all books of category WEB? If so, I'm afraid the approaches will vary depending on what exactly you have. I'm guessing you have XPath 1.0. For it there are two approaches but neither can be done with a single expression and vary depending on S3L of choise.You could scan the directory for all the XMLs you want, generate a new XML from them with XIncludes having each file as part of each XInclude and apply those XIncludes then to combine all files into one. Then query the resulting XML with: count(//book[@category='WEB']) Or you could again scan the directory for all the XMLs you want, and cast the XPath expression above for each of them. Add the result to a variable and increment that variable with the next result and so on, until you have your final count. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now