|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Returning "pre-pos" contextMichael Kay mhk at mhk.me.ukThu Jan 5 17:34:34 PST 2006
Your terminology is a bit out: you're looking for elements, not tags: but I think what you want is to find three consecutive <tok> elements whose child <orth> elements contain the values AA, BB, and CC respectively. I'm not sure why you've focused on the middle one of the three explicitly, but I'll retain that emphasis in the solution: tok[orth='BB'][following-sibling::tok[1]/orth='CC'][preceding-sibling::tok[1 ]/orth='AA'] Of course this assumes that your XQuery implementation offers all the axes. But then you don't actually need XQuery for this: the above is pure XPath 1.0. Michael Kay http://www.saxonica.com/ _____ From: http://xquery.com/mailman/listinfo/talk [mailto:http://xquery.com/mailman/listinfo/talk] On Behalf Of Elarrat, EFC Sent: 05 January 2006 16:27 To: http://xquery.com/mailman/listinfo/talk Subject: Returning "pre-pos" context Happy new year everybody I have this xml structure <s> <tok> <orth>dataxxx</orth> <lex> <ctag>datayyy</ctag> </lex> </tok> ...(mani tok tags for a s tag) </s> I tried to do the following: find the tags that contains some data beginning with d (for example) on the ORTH tag - Ok You guys already helped me with that find the tags that contains some data beginning with d (for example) on the CTAG tag - Ok You guys already helped me with that find the tags that contains some data beginning with d (for example) on the ORTH AND the CTAG tag - Ok You guys already helped me with that And now the hard one (for me, of course) within the rules above, I would like to find the same as before, but with some others tags before it, and some others tag after it. It's hard to explain...so I'm going to give an example: This xml <s> <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> </s> 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. Is it possible to do something like this? Thanks for you attention. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://xquery.com/pipermail/talk/attachments/20060105/11ad5dbe/attachment.htm
|
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
|






