I adapted code from the OPS sorting example for situation where the number of columns varies, by replacing the xsl:for-each construct by xforms:repeat. Within the xforms:repeat I have the group shown below which becomes visible if the "context" column name is not the sort name. For all columns fulfilling this condition the sort icon is shown as bullet (indeed the correct sort images are shown for all columns). I have a problem with the third xforms:setvalue statement - it behaves as if the @name did not have a value. However, I know it does have a value because the group "ref" attribute value is evaluated correctly and also the label value is correct if I remove the image appearance attrib. from the trigger. I would assume that the 3rd setvalue "value" is also in the same context as the rest of the group element - is that a correct assumption? If so, does anybody have a clue as to why do I see this problem? <xforms:group ref=".[instance('main-instance')/form/sort-by != @name]"> <xforms:trigger appearance="xxforms:image"> <xxforms:img src="/images/sort-natural.gif"/> <xforms:label value="@name"/> <xforms:action ev:event="DOMActivate"> <xforms:setvalue ref="instance('main-instance')/form/sort-order">ascending</xforms:setvalue> <xforms:setvalue ref="instance('main-instance')/form/sort-data-type">text</xforms:setvalue> <xforms:setvalue ref="instance('main-instance')/form/sort-by" value="@name"/> <xforms:send submission="sort"/> </xforms:action> </xforms:trigger> </xforms:group> Thanks Alex. -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Alex,
> I have a problem with the third xforms:setvalue statement - it behaves > as if the @name did not have a value. However, I know it does have a > value because the group "ref" attribute value is evaluated correctly and > also the label value is correct if I remove the image appearance attrib. > from the trigger. > I would assume that the 3rd setvalue "value" is also in the same > context as the rest of the group element - is that a correct > assumption? Unfortunately it is not. According to the spec: http://www.w3.org/TR/xforms/slice10.html#action-setvalue "value - Optional XPath expression to evaluate, with the result stored in the selected instance data node. The evaluation context for this XPath expression is the result from the Single Node Binding." So @name is relative to the expression: instance('main-instance')/form/sort-by This is of course not what you want, but it's the way XForms works at the moment. You can use an extension function to work around this. Give an id to your group, e.g. id="my-group". Then write: value="xxforms:context('my-group')/@name" In the future, we hope that variables will help address that kind of context-related issues. -Erik > If so, does anybody have a clue as to why do I see this problem? > > <xforms:group ref=".[instance('main-instance')/form/sort-by != @name]"> > <xforms:trigger appearance="xxforms:image"> > <xxforms:img src="/images/sort-natural.gif"/> > <xforms:label value="@name"/> > <xforms:action ev:event="DOMActivate"> > <xforms:setvalue > ref="instance('main-instance')/form/sort-order">ascending</xforms:setvalue> > <xforms:setvalue > ref="instance('main-instance')/form/sort-data-type">text</xforms:setvalue> > <xforms:setvalue > ref="instance('main-instance')/form/sort-by" value="@name"/> > <xforms:send submission="sort"/> > </xforms:action> > </xforms:trigger> > </xforms:group> > > Thanks > > Alex. -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Erik,
It works like a charm. Thank you. A. On Oct 7, 2006, at 4:27 PM, Erik Bruchez wrote: > Alex, > > > I have a problem with the third xforms:setvalue statement - it > behaves > > as if the @name did not have a value. However, I know it does have a > > value because the group "ref" attribute value is evaluated > correctly and > > also the label value is correct if I remove the image appearance > attrib. > > from the trigger. > > > I would assume that the 3rd setvalue "value" is also in the same > > context as the rest of the group element - is that a correct > > assumption? > > Unfortunately it is not. According to the spec: > > http://www.w3.org/TR/xforms/slice10.html#action-setvalue > > "value - Optional XPath expression to evaluate, with the result > stored in the selected instance data node. The evaluation context > for this XPath expression is the result from the Single Node > Binding." > > So @name is relative to the expression: > > instance('main-instance')/form/sort-by > > This is of course not what you want, but it's the way XForms works at > the moment. You can use an extension function to work around > this. Give an id to your group, e.g. id="my-group". Then write: > > value="xxforms:context('my-group')/@name" > > In the future, we hope that variables will help address that kind of > context-related issues. > > -Erik > > > If so, does anybody have a clue as to why do I see this problem? > > > > <xforms:group ref=".[instance('main-instance')/form/sort-by != > @name]"> > > <xforms:trigger appearance="xxforms:image"> > > <xxforms:img src="/images/sort-natural.gif"/> > > <xforms:label value="@name"/> > > <xforms:action ev:event="DOMActivate"> > > <xforms:setvalue > > ref="instance('main-instance')/form/sort-order">ascending</ > xforms:setvalue> > > <xforms:setvalue > > ref="instance('main-instance')/form/sort-data-type">text</ > xforms:setvalue> > > <xforms:setvalue > > ref="instance('main-instance')/form/sort-by" value="@name"/> > > <xforms:send submission="sort"/> > > </xforms:action> > > </xforms:trigger> > > </xforms:group> > > > > Thanks > > > > Alex. > > -- > Orbeon - XForms Everywhere: > http://www.orbeon.com/blog/ > > > > -- > You receive this message as a subscriber of the ops- > [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |