I'm running this on eXide, I'll try it on Saxon.

On Fri, Jul 13, 2012 at 5:48 PM, Michael Kay <m...@saxonica.com> wrote:
>
> On 13/07/2012 17:35, Ihe Onwuka wrote:
>>
>> didn't want to tamper with the definition of $models as it is used
>> elsewhere (you are seeing a cut down version of the code), but having
>> removed a /* from its definition, that hasn't worked either (I get the
>> same result reported earlier).
>
> Well, there's another mistake then. Removing the /* worked for me.
>
> Michael Kay
> Saxonica
>>
>>
>> On Fri, Jul 13, 2012 at 4:18 PM, Michael Kay <m...@saxonica.com> wrote:
>>>
>>> Your problem is that the initialization of $models goes down two levels
>>> below the document node, so it is bound to a sequence of Model elements,
>>> so
>>> when you do $models/* you are selecting the children of the Model
>>> elements,
>>> but there are no child elements to select. Remove a /* either from the
>>> definition of $models or from the expression where it is used.
>>>
>>> Michael Kay
>>> Saxonica
>>>
>>>
>>> On 13/07/2012 15:41, Ihe Onwuka wrote:
>>>>
>>>> xquery version "1.0";
>>>>
>>>>
>>>> declare namespace b2b ="http://www.b2b.net/plants";;
>>>> declare namespace xf="http://www.w3.org/2002/xforms";;
>>>> declare namespace html="http://www.w3.org/1999/xhtml";;
>>>> declare namespace ev="http://www.w3.org/2001/xml-events";;
>>>>
>>>> declare variable $configDir as xs:string :="config";
>>>>
>>>> declare variable $models as element()*
>>>> :=doc(concat($configDir,"/modelNames.xml"))/*/*;
>>>>
>>>> declare function local:bindModel($x,$y,$z) {$x};
>>>>
>>>> declare function local:capitalise($str)
>>>> {
>>>>       concat(upper-case(substring($str,1,1)),substring($str,2))
>>>> };
>>>>
>>>> declare function local:defineModelRoot($model as element())
>>>> {
>>>>      element {concat('b2b:',local:capitalise($model/text()))}
>>>>               {element xf:bind {attribute repeat
>>>> {local:getBindingFileName($model)}}}
>>>> };
>>>>
>>>> declare function local:getBindingFileName($model as element()) as
>>>> xs:string
>>>> {
>>>>      concat($model/@singular,'Bindings.xml')
>>>> };
>>>>       <switch xmlns="http://www.w3.org/2002/xforms";>
>>>>         {$models/*/<case
>>>>
>>>>
>>>> id='{text()}Case'>{local:bindModel(local:defineModelRoot(.),"",xs:QName('group'))}</case>}
>>>>       </switch>
>>>
>>>
>>>
>>> _______________________________________________
>>> talk@x-query.com
>>> http://x-query.com/mailman/listinfo/talk
>>
>> _______________________________________________
>> talk@x-query.com
>> http://x-query.com/mailman/listinfo/talk
>>
>
>
> _______________________________________________
> talk@x-query.com
> http://x-query.com/mailman/listinfo/talk
_______________________________________________
talk@x-query.com
http://x-query.com/mailman/listinfo/talk

Reply via email to