[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

returning elements without duplicates, based on an XML schema and using an attribute as context node

G. Ken Holman gkholman at CraneSoftwrights.com
Thu Mar 26 18:08:08 PST 2009


  returning elements without duplicates
At 2009-03-26 10:49 -0500, Philip Cantin wrote:
>I am trying to access the 'maxOccurs' attribute within the for-loop, 
>where $ref is the 'ref' attribute, and return distinct <xf:bind> 
>elements with no duplicate elements. However, I can't seem to set 
>the $max variable properly using XPath functions, without getting an 
>error. I imagine it must have something to do with 
>setting/finding/using the current context.
>
>
>The XQuery code looks like this:
>
>
>if (exists($schema//xs:element[exists(@maxOccurs) and @maxOccurs != '1']))
>then (
>    for $ref in 
> distinct-values($schema//xs:element[exists(@maxOccurs) and 
> @maxOccurs != '1' and @maxOccurs ne 'unbounded']/@ref)
>...
>Can someone show me the proper way to access the maxOccurs attribute 
>from the ref attribute,

   $ref/../@maxOccurs

>and/or provide me with a link that can help me understand this 
>situation a little more?

All attributes are attached to an element ... the element is the 
attribute's parent ... "sibling" attributes are attached to the same 
parent.  So the address I gave to you goes to the attribute's 
parent's attached maxOccurs attribute.

I hope this helps.

. . . . . . . . . . . Ken

--
XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08
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:http://x-query.com/mailman/listinfo/talk
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



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.