Thanks Pradeep,
Your suggestion helped me resolve the issue.
Thanks,
Radhika
On Tue, Jun 8, 2010 at 7:20 PM, Pradeep Maddireddy <[email protected]>wrote:
> Hi..!
>
> Can you try this
>
> cts:search(collection(),
> cts:and-query((
> cts:element-attribute-range-query(xs:QName("book"),
> xs:QName("length"), ">=", 26),
> cts:element-attribute-range-query(xs:QName("book"),
> xs:QName("length"), "<=", 2620),
> cts:element-query(xs:QName("search"),
> cts:element-attribute-value-query(xs:QName("chapter"),
> xs:QName("name"), ('chap1','chap2','chap3','chap4')))
> ))
> )
>
> Thanks
> Pradeep Maddireddy
>
> On 6/8/10, Vedavalli Radhika <[email protected]> wrote:
> > Hi,
> >
> > *Current xml structure:*
> >
> > <book author="Author" length="262" id="unique-id" chapCnt="4">
> >
> > <chapter pageStart="5" name="chap1" pageEnd="80" />
> >
> > <chapter pageStart="83" name="chap2" pageEnd="180" />
> >
> > </book>
> >
> >
> > *XQuery used:*
> >
> > for $a in cts:search(collection(),
> > cts:and-query((cts:element-attribute-range-query(xs:QName("book"),
> > xs:QName("length"), ">=", 26),
> > cts:element-attribute-range-query(xs:QName("book"), xs:QName("length"),
> > "<=", 2620), cts:element-attribute-value-query(xs:QName("chapter"),
> > xs:QName("name"), ('chap1','chap2','chap3','chap4')))), ("score-simple"))
> >
> > *Proposed structure:*
> >
> > <book author="Author" length="262" id="unique-id" chapCnt="4">
> >
> > <search>
> >
> > <chapter pageStart="5" name="chap1" pageEnd="80" />
> >
> > <chapter pageStart="83" name="chap2" pageEnd="180" />
> >
> > </search>
> >
> > <retrieve>
> >
> > <chapter pageStart="5" name="chap1" pageEnd="80" />
> >
> > <chapter pageStart="83" name="chap2" pageEnd="180" />
> >
> > <chapter pageStart="182" name="chap3" pageEnd="401" />
> >
> > </retrieve>
> >
> > </book>
> > Our requirement is to find out all the matching chapter names inside the
> > search tag name alone. There can be same chapter names available inside
> > retrieve tag as well. But that should not be retrieved. I tried replacing
> > the QName "chapter" by "search". But this is not valid as we do not have
> > "name" QName within it. The current xquery if used on the proposed xml,
> it
> > is retrieving those xmls whcih matches the chapternames inside the
> retrieve
> > tag.
> > I also tried providing multiple QName elements for the first argument -
> > cts:element-attribute-value-query((xs:QName("search"),
> xs:QName("chapter")).
> > This as giving back the results as the previous query. It was just
> > performing a OR etween search and chapter qnames.
> > Request your help.
> >
> > Thanks,
> > Radhika.
> >
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general