Michael,<br><br>Oh, yes...I forgot to mention earlier:<br><br>I'd like no two <xf:bind> element tags to be the same; that's why I was using the distinct-values() function.<br><br><br>~PJC<br><br><div class="gmail_quote">
On Thu, Mar 26, 2009 at 1:51 PM, Michael Kay <span dir="ltr"><<a href="mailto:mike@saxonica.com">mike@saxonica.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
I want the XQuery to determine if the @maxOccurs attribute exists in<br>
an <xs:element> tag somewhere in the schema, and its value isn't 1. If this<br>
is true, then, for all elements that have a @ref attribute in the schema<br>
(because we now know there's at least one), the XQuery should get the string<br>
value of the element's @ref attribute (what I wanted $name to be), along<br>
with the value of element's @maxOccurs attribute (what i wanted $max to be),<br>
and lastly the string value of $max (what I wanted $index_max to be). Then<br>
finally, I just wanted to use these three values within an <xf:bind> tag<br>
that was to be returned.<br>
<br>
<br>
</div>That translates to me as:<br>
<br>
if (//xs:element[@maxOccurs[.!="1"]])<br>
then for $e in //xs:element[@ref]<br>
return <xf:bind<br>
id="{$e/@ref}-add-trigger"<br>
nodeset="instance('views')/{$e/@ref}-add-trigger"<br>
<br>
relevant="instance('save-data')//{$e/@ref}[{$e/@maxOccurs}]"/><br>
else ()<br>
<br>
I can't really see where the distinct-values() comes into it - it doesn't<br>
appear in your English description.<br>
<div><div></div><div class="h5"><br>
Michael Kay<br>
<a href="http://www.saxonica.com/" target="_blank">http://www.saxonica.com/</a><br>
<br>
</div></div></blockquote></div><br>