Anil Shekhar wrote:

  Hi,

> for $speech in doc()//SPEECH
> let $speaker := $speech/SPEAKER

  Here, you loop over each speech.  For each one of them, you bind
the variable $speech to it, and then evaluate the loop body.
Within which you bind the variable $speaker, etc.

> for $d in doc()
> let $speech := $d//SPEECH
> let $speaker := $speech/SPEAKER

  Here, you loop over document nodes.  For each of them, you bind
all its speeches at once to the variable $speech.  So $speaker in
turn is bound to the speakers of every speeches in this document.
And by <h3>{ $speaker/text() }</h3> you create an element the
content of which is the concatenation of all the text node children
of all the speaker elements.

  This is a good example where declaring the type (an arity) of
the variables would have helped you:

    for $d in doc()
    let $speech  as element(SPEECH)  := $d//SPEECH
    let $speaker as element(SPEAKER) := $speech/SPEAKER

  Hope that helps (by the way, upper case element names look kind
of weird,) regards,

-- 
Florent Georges
http://www.fgeorges.org/





















_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to