I'm getting very close to finishing the autocomplete task for Library of Congress subjects that Scott Prater and I have been writing about on the list over the last few weeks. His most recent suggestion (http://orbeon-forms-ops-users.24843.n4.nabble.com/Setting-content-of-text-field-in-fr-autocomplete-tt2216656.html#a2239321) works, but my subject repeat can occur within several different elements located in my document. As a result, I get an error about duplicate id's.
So my question is, can the id of the xforms:repeat and fr:autocomplete be generated dynamically? For example, <xxforms:variable name="ancestor" select="concat(parent::node()/parent::node()/parent::node()/name(), '-', parent::node()/parent::node()/name(), '-', parent::node()/name())"/> <fr:autocomplete ref="." dynamic-itemset="true" id="{concat($ancestor, '-autocomplete-control')}"> ... </fr:autocomplete> This, however, does not work. Is there another approach or are id's completely static? Similarly, if I put a static id on fr:autocomplete and alter my model for testing purposes with the following: <xforms:action ev:event="xforms-ready" xxforms:iterate="instance('guide')/archdesc//subject"> <xxforms:variable name="ancestor" select="concat(parent::node()/parent::node()/parent::node()/name(), '-', parent::node()/parent::node()/name(), '-', parent::node()/name())"/> <xforms:insert context="instance(concat($ancestor, '-aggregate'))" nodeset="response" origin="instance('response-temp')"/> <xforms:setvalue ref="instance(concat($ancestor, '-aggregate'))/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" value="normalize-space(context())"/> <xforms:setindex repeat="concat($ancestor, '-repeat')" index="position()"/> <xforms:dispatch target="concat($ancestor, '-autocomplete-control')" name="fr-set-label"> <xxforms:context name="label" select="instance(concat($ancestor, '-aggregate'))/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" /> </xforms:dispatch> </xforms:action> I receive an error that the target/repeat of setindex or dispatch must be static. However, I am able to dynamically populate several different itemsets with the previous commands within the xxforms:iterate action I'm really stuck; I may have to alter my approach entirely, but perhaps there is an alternative method that I am not considering. Thanks, Ethan -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Ethan,
How do you get to have duplicate ids? By using XSLT? To answer the first question, no, ids, in the sense of the @id attribute on a control, cannot be dynamic. This said, at runtime, the XForms engine has a notion of "effective id" for repeats. Now, regarding setindex and dispatch, there is no problem: just use the AVT syntax, with curly brackets: <xforms:setindex repeat="{concat($ancestor, '-repeat')}" index="position()"/> <xforms:dispatch target="{concat($ancestor, '-autocomplete-control')}" ...> -Erik On Thu, Jun 3, 2010 at 8:50 AM, Ethan Gruber <[hidden email]> wrote: > I'm getting very close to finishing the autocomplete task for Library of > Congress subjects that Scott Prater and I have been writing about on the > list over the last few weeks. His most recent suggestion > (http://orbeon-forms-ops-users.24843.n4.nabble.com/Setting-content-of-text-field-in-fr-autocomplete-tt2216656.html#a2239321) > works, but my subject repeat can occur within several different elements > located in my document. As a result, I get an error about duplicate id's. > > So my question is, can the id of the xforms:repeat and fr:autocomplete be > generated dynamically? For example, > > <xxforms:variable name="ancestor" > select="concat(parent::node()/parent::node()/parent::node()/name(), '-', > parent::node()/parent::node()/name(), '-', parent::node()/name())"/> > <fr:autocomplete ref="." dynamic-itemset="true" id="{concat($ancestor, > '-autocomplete-control')}"> > ... > </fr:autocomplete> > > This, however, does not work. Is there another approach or are id's > completely static? Similarly, if I put a static id on fr:autocomplete and > alter my model for testing purposes with the following: > > <xforms:action ev:event="xforms-ready" > xxforms:iterate="instance('guide')/archdesc//subject"> > <xxforms:variable name="ancestor" > select="concat(parent::node()/parent::node()/parent::node()/name(), '-', > parent::node()/parent::node()/name(), '-', parent::node()/name())"/> > <xforms:insert context="instance(concat($ancestor, > '-aggregate'))" nodeset="response" > origin="instance('response-temp')"/> > <xforms:setvalue > ref="instance(concat($ancestor, > '-aggregate'))/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" > value="normalize-space(context())"/> > <xforms:setindex repeat="concat($ancestor, '-repeat')" > index="position()"/> > <xforms:dispatch target="concat($ancestor, > '-autocomplete-control')" name="fr-set-label"> > <xxforms:context name="label" > select="instance(concat($ancestor, > '-aggregate'))/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" > /> > </xforms:dispatch> > </xforms:action> > > I receive an error that the target/repeat of setindex or dispatch must be > static. However, I am able to dynamically populate several different > itemsets with the previous commands within the xxforms:iterate action > > I'm really stuck; I may have to alter my approach entirely, but perhaps > there is an alternative method that I am not considering. > > Thanks, > Ethan > > > -- > You receive this message as a subscriber of the [hidden email] mailing > list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Erik,
Here is how I have a duplicate id error: I have an xforms:repeat block for "subject". The @id is "subject-repeat". A subject can occur within several different elements in my model, so in order reduce repetition and make the application easier to maintain, the xforms:repeat block is made into its own xml file, subject.xml, which is then xincluded several places in my main form xhtml file. I assume, since this xforms-repeat node appears several times within the form once it is constructed, an error regarding duplicate id's occurs. I can put together a test case and email it. Ethan On Thu, Jun 3, 2010 at 11:34 PM, Erik Bruchez <[hidden email]> wrote: Ethan, -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Ethan,
Right, that won't work! Either you manage to avoid using such ids, or use XSLT instead of XInclude to generate individual ids, or you make those reusable components XBL components. That's in fact one of the major reasons we developed a proper component system in Orbeon Forms, to avoid this kind of issues ;) -Erik On Fri, Jun 4, 2010 at 5:41 AM, Ethan Gruber <[hidden email]> wrote: > Hi Erik, > > Here is how I have a duplicate id error: > > I have an xforms:repeat block for "subject". The @id is "subject-repeat". > A subject can occur within several different elements in my model, so in > order reduce repetition and make the application easier to maintain, the > xforms:repeat block is made into its own xml file, subject.xml, which is > then xincluded several places in my main form xhtml file. I assume, since > this xforms-repeat node appears several times within the form once it is > constructed, an error regarding duplicate id's occurs. I can put together a > test case and email it. > > Ethan > > On Thu, Jun 3, 2010 at 11:34 PM, Erik Bruchez <[hidden email]> wrote: >> >> Ethan, >> >> How do you get to have duplicate ids? By using XSLT? >> >> To answer the first question, no, ids, in the sense of the @id >> attribute on a control, cannot be dynamic. >> >> This said, at runtime, the XForms engine has a notion of "effective >> id" for repeats. >> >> Now, regarding setindex and dispatch, there is no problem: just use >> the AVT syntax, with curly brackets: >> >> <xforms:setindex repeat="{concat($ancestor, '-repeat')}" >> index="position()"/> >> <xforms:dispatch target="{concat($ancestor, '-autocomplete-control')}" >> ...> >> >> -Erik >> >> On Thu, Jun 3, 2010 at 8:50 AM, Ethan Gruber <[hidden email]> wrote: >> > I'm getting very close to finishing the autocomplete task for Library of >> > Congress subjects that Scott Prater and I have been writing about on the >> > list over the last few weeks. His most recent suggestion >> > >> > (http://orbeon-forms-ops-users.24843.n4.nabble.com/Setting-content-of-text-field-in-fr-autocomplete-tt2216656.html#a2239321) >> > works, but my subject repeat can occur within several different elements >> > located in my document. As a result, I get an error about duplicate >> > id's. >> > >> > So my question is, can the id of the xforms:repeat and fr:autocomplete >> > be >> > generated dynamically? For example, >> > >> > <xxforms:variable name="ancestor" >> > select="concat(parent::node()/parent::node()/parent::node()/name(), '-', >> > parent::node()/parent::node()/name(), '-', parent::node()/name())"/> >> > <fr:autocomplete ref="." dynamic-itemset="true" id="{concat($ancestor, >> > '-autocomplete-control')}"> >> > ... >> > </fr:autocomplete> >> > >> > This, however, does not work. Is there another approach or are id's >> > completely static? Similarly, if I put a static id on fr:autocomplete >> > and >> > alter my model for testing purposes with the following: >> > >> > <xforms:action ev:event="xforms-ready" >> > xxforms:iterate="instance('guide')/archdesc//subject"> >> > <xxforms:variable name="ancestor" >> > select="concat(parent::node()/parent::node()/parent::node()/name(), '-', >> > parent::node()/parent::node()/name(), '-', parent::node()/name())"/> >> > <xforms:insert context="instance(concat($ancestor, >> > '-aggregate'))" nodeset="response" >> > origin="instance('response-temp')"/> >> > <xforms:setvalue >> > ref="instance(concat($ancestor, >> > >> > '-aggregate'))/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" >> > value="normalize-space(context())"/> >> > <xforms:setindex repeat="concat($ancestor, '-repeat')" >> > index="position()"/> >> > <xforms:dispatch target="concat($ancestor, >> > '-autocomplete-control')" name="fr-set-label"> >> > <xxforms:context name="label" >> > select="instance(concat($ancestor, >> > >> > '-aggregate'))/response[last()]/lst[@name='terms']/lst[@name='subject']/int/@name" >> > /> >> > </xforms:dispatch> >> > </xforms:action> >> > >> > I receive an error that the target/repeat of setindex or dispatch must >> > be >> > static. However, I am able to dynamically populate several different >> > itemsets with the previous commands within the xxforms:iterate action >> > >> > I'm really stuck; I may have to alter my approach entirely, but perhaps >> > there is an alternative method that I am not considering. >> > >> > Thanks, >> > Ethan >> > >> > >> > -- >> > You receive this message as a subscriber of the [hidden email] >> > mailing >> > list. >> > To unsubscribe: mailto:[hidden email] >> > For general help: mailto:[hidden email]?subject=help >> > OW2 mailing lists service home page: http://www.ow2.org/wws >> > >> > >> >> >> -- >> You receive this message as a subscriber of the [hidden email] mailing >> list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> OW2 mailing lists service home page: http://www.ow2.org/wws >> > > > > -- > You receive this message as a subscriber of the [hidden email] mailing > list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |