Michael,<br><br>Oh, yes...I forgot to mention earlier:<br><br>I&#39;d like no two &lt;xf:bind&gt; element tags to be the same; that&#39;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">&lt;<a href="mailto:mike@saxonica.com">mike@saxonica.com</a>&gt;</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 &lt;xs:element&gt; tag somewhere in the schema, and its value isn&#39;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&#39;s at least one), the XQuery should get the string<br>
value of the element&#39;s @ref attribute (what I wanted $name to be), along<br>
with the value of element&#39;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 &lt;xf:bind&gt; tag<br>
that was to be returned.<br>
<br>
<br>
</div>That translates to me as:<br>
<br>
if (//xs:element[@maxOccurs[.!=&quot;1&quot;]])<br>
then for $e in //xs:element[@ref]<br>
     return &lt;xf:bind<br>
               id=&quot;{$e/@ref}-add-trigger&quot;<br>
               nodeset=&quot;instance(&#39;views&#39;)/{$e/@ref}-add-trigger&quot;<br>
<br>
relevant=&quot;instance(&#39;save-data&#39;)//{$e/@ref}[{$e/@maxOccurs}]&quot;/&gt;<br>
else ()<br>
<br>
I can&#39;t really see where the distinct-values() comes into it - it doesn&#39;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>