Re: [Xsltforms-support] XForms, data in a repeat from a parallel instance nodeset
Brought to you by:
alain-couthures
|
From: Klotz, L. <Lei...@xe...> - 2009-12-07 16:50:20
|
It's not xf:variable, but xf:setvalue and instance() function:
<xf:instance id="positions">
<data xmlns="">
<position />
</data
</xf:instance>
...
<xf:setvalue ref="instance('positions')/position">1</xf:setvalue>
<xf:setvalue ref="instance('positions')/position value="count(instance('main')/path/to/things/thing)-1" />
etc.
Then to use them:
<xf:input ref="path/to/things/thing[instance('positions')/position]"> ...
Leigh.
________________________________
From: Jason Kleban [mailto:ja...@bi...]
Sent: Saturday, December 05, 2009 8:42 AM
To: COUTHURES Alain
Cc: xsl...@li...
Subject: Re: [Xsltforms-support] XForms,data in a repeat from a parallel instance nodeset
Good to know about the axes support. What I've done instead is to make a new attribute for each node in my answers model, @index, and bind it to position. Then, I can reference that value with current()/@index from with the xpath to the question's index. One downside, potentially is the addition of the @index.
How are we to reference xf:variables from within xpath or otherwise? I have been unsuccessful. The xsltforms parser doesn't like the '$'. Can you give examples?
Thanks,
Jason
On Dec 5, 2009, at 5:38 AM, COUTHURES Alain <ala...@ag...> wrote:
Jason,
Axes such as "preceding-sibling::" are not yet supported by the XPath analyzer of XSLTForms, which is written with XSLT 1.0.
About variables, you can create a work instance for them and use "xf:setvalue" to change their values.
Thank you for testing XSLTForms!
-Alain
I'm still stuck on this. I've tried:
<xf:output ref="instance('questions')/question[position() = (count(current()/preceding-sibling::*) + 1)]/@text"></xf:output>
but xsltforms keeps complaining about the preceding-sibling::*
Since I need instance('questions')/question[position() = (count(current()/preceding-sibling::*) + 1)] for several things, I'd like to be able to store this in a variable and use it throughout my repeater - however, I'm not sure how xsltforms supports this.
Thanks,
Jason
On Fri, Dec 4, 2009 at 11:18 AM, Jason Kleban < <mailto:ja...@bi...> ja...@bi...> wrote:
I have an XForm survey. I'd like to keep the survey questions in a separate xf:instance of the same model from the xf:instance that collects the answers. In one instance, a group containing 10 questions. In a second instance, a group to hold the 10 answers. The second instance will be submitted.
I've tried using logic like the following:
<xf:output ref="instance('questions')/question[position()]/@text"></xf:output>
but that position() is always returning 1, because the context is of the questions xf:instance. Using the index('current-repeater') updates all 10 displayed questions to be the question at the index of the most recently focused repeat iteration.
Is there a way to use a temporary variable in the xpath to accomplish this?
Thanks,
Jason
________________________________
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
<http://p.sf.net/sfu/redhat-sfdev2dev> http://p.sf.net/sfu/redhat-sfdev2dev
________________________________
_______________________________________________
Xsltforms-support mailing list
<mailto:Xsl...@li...> Xsl...@li...
<https://lists.sourceforge.net/lists/listinfo/xsltforms-support> https://lists.sourceforge.net/lists/listinfo/xsltforms-support
|