|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Returning "pre-pos" contextDavid Carlisle davidc at nag.co.ukThu Jan 5 17:28:24 PST 2006
> find the tags that contains some data beginning with d (for example) on the > ORTH tag - Ok You guys already helped me with that note that Xquery (like XSLT and Xpath) has no access to the tags in a document, only to the tree structure produced by parsing those tags. I assume you mean element rather than tag. tag doesn't mean element, the content of the tag <s> is "s". The content of the element s is the sequence of white space and tok elements. > What I would like to do, is to find the BB, but with the AA and the CC with > it, so the final return value would be like: AA BB CC. Not sure what you want returned, just those three strings or the 3 orth elements containing those, or the three tok elements containing those orth elements. I'll assume the last of these, in which case, perhaps /s/tok[orth='BB']/(preceding-sibling::*[1],.,following-sibling::*[1]) assuming your processor supports the sibling axes (if not these can always be rewritten to use <<) If you want just the sequence of strings AA BB CC then: /s/tok[orth='BB']/(preceding-sibling::*[1],.,following-sibling::*[1])/string(orth) saxon produces $ saxon8q -s tok.xml tok.xq <?xml version="1.0" encoding="UTF-8"?> <tok> <orth>AA</orth> <lex> <ctag>XX</ctag> </lex> </tok> <tok> <orth>BB</orth> <lex> <ctag>YY</ctag> </lex> </tok> <tok> <orth>CC</orth> <lex> <ctag>ZZ</ctag> </lex> </tok> for the first expression and $ saxon8q -s tok.xml tok.xq <?xml version="1.0" encoding="UTF-8"?>AA BB CC for the second David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






