[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

XPath Issues in XQuery

Wei, Alice J. ajwei at indiana.edu
Sat Feb 16 06:34:04 PST 2008


  XPath Issues in XQuery
Hi, XQueriers:

   I have an XQuery as in the following:

let $ad := fn:collection("xmldb:exist://db/cbml")
let $volume := $ad//seriesStmt/idno[@type='volume'][1]
let $issue := $ad//seriesStmt/idno[@type='issue'][1]
let $journal := $ad//seriesStmt/title[@level='journal'][1]
let $ad2 := $ad//ad/head[contains(., 'muscle') or contains(., upper-case('muscle'))]
let $sorted_result:=
for $doc in distinct-values($ad2)
order by $doc
return $doc
for $r at $count in $sorted_result
let $nodes := $ad2[. = $r][1]
return
<ad>
<statistics>
Showing Result: {$count} / {count($sorted_result)}
</statistics>
<source>
<journal>{data($journal)}</journal>
<publication_information>Volume {data($volume)[1]}, Issue {data($issue)}</publication_information>
</source>
{$nodes}
</ad>

Right now, I have a sample entry as in the following:

<ad>
<statistics> Showing Result: 1 / 2</statistics>
<source>
<journal>My Journal My Journal My Journal My Journal My Journal My Journal My Journal My Journal </journal>
<publication_information>Volume 1 , Issue 2 4 1 3 5 6 7 </publication_information>
</source>
<head rend ="bgblack">
<emph rend ="red">FREE MUSCLE Secrets</emph>
</head>
</ad>

What I want:
<ad>
<statistics> Showing Result: 1 / 2</statistics>
<source>
<journal>My Journal</journal>
<publication_information>Volume 1 , Issue 1</publication_information>
</source>
<head rend ="bgblack">
<emph rend ="red">FREE MUSCLE Secrets</emph>
</head>
</ad>

How much would I have to adjust my XPath expression to return something like above?
Any help is appreciated.
======================================================
Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
http://x-query.com/mailman/listinfo/talk



Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.