[xquery-talk] xquery: iteration simulation

G. Ken Holman gkholman at CraneSoftwrights.com
Sun Mar 8 17:16:21 PST 2009


At 2009-03-08 21:29 +0100, Michalmas wrote:
>Hello guys,
>
>Can you help me with the following problem:
>
>I have some XML.

It would help volunteers if you could post a contrived example of the 
nature of the structures.  Not all 50 levels, but still, some examples.

>Now, i need to query it. But what i need to do, is to make queries 
>of the form:
>
>count(mainNode//someStr)
>count(mainNode//someStr/someStr)
>(...)
>count(mainNode//someStr/someStr/someStr/someStr/someStr/someStr/someStr/someStr)

How are you expressing the "someStr" name?  Is it fixed?  Is it variable?

You will probably not use "//" as you have above, but it may have a 
role in the solution.

>The deep level of the last query may be even around 50 (so, 50 queries).

So you want one of every depth?  Is it always the same element name 
that is parent/child?

>Such set of queries will be repeated for about 100 keywords (like 
>someStr). In total, that gives about 500 queries to create.

Ummmmm ... I make that 5000 queries.  Or 100 queries that each give 50 results.

>Is is posible to write iteration in XQuery for that. Or pass it as a function?

Probably with two passes where the first pass creates the query for 
the second pass to execute.

But it would help to have some representative data and an example 
result for that data.

. . . . . . . . . Ken

--
XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz
XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman at CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/q/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/q/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal



More information about the talk mailing list