Thread: [Xsltforms-support] constraint against the sum of a series of attributes
Brought to you by:
alain-couthures
From: peter w. <p....@in...> - 2013-05-04 10:25:05
|
Hello List I have a model with a set of one or more <sector/> elements where the sum of the sector/@percentage attributes should always equal 100. how do I express this as a bind constraint? Cheers Peter ____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! Check it out at http://www.inbox.com/earth |
From: peter w. <p....@in...> - 2013-05-04 10:34:15
|
Whoops! silly question! I was calculating on individuals i.e.<xforms:bind nodeset="sector/@percentage" constraint="sum(.) = 100" /> and not the nodeset :( <xforms:bind nodeset="sector/@percentage" constraint="sum(sector/@percentage) = 100" /> > -----Original Message----- > From: p....@in... > Sent: Sat, 4 May 2013 02:24:58 -0800 > To: xsl...@li... > Subject: [Xsltforms-support] constraint against the sum of a series of > attributes > > Hello List > > I have a model with a set of one or more <sector/> elements where the sum > of the sector/@percentage attributes should always equal 100. > > how do I express this as a bind constraint? > > Cheers > > Peter > > ____________________________________________________________ > FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! > Check it out at http://www.inbox.com/earth > > > > ------------------------------------------------------------------------------ > Get 100% visibility into Java/.NET code with AppDynamics Lite > It's a free troubleshooting tool designed for production > Get down to code-level detail for bottlenecks, with <2% overhead. > Download for free and get started troubleshooting in minutes. > http://p.sf.net/sfu/appdyn_d2d_ap2 > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support ____________________________________________________________ GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails |
From: Alain C. <ala...@ag...> - 2013-05-04 11:08:26
|
<xforms:bind nodeset="sector/@percentage" constraint="sum(../../sector/@percentage) = 100" /> ???? Le 04/05/2013 12:34, peter winstanley a écrit : > Whoops! silly question! > I was calculating on individuals > i.e.<xforms:bind nodeset="sector/@percentage" constraint="sum(.) = 100" /> > > and not the nodeset :( > > <xforms:bind nodeset="sector/@percentage" constraint="sum(sector/@percentage) = 100" /> > >> -----Original Message----- >> From: p....@in... >> Sent: Sat, 4 May 2013 02:24:58 -0800 >> To: xsl...@li... >> Subject: [Xsltforms-support] constraint against the sum of a series of >> attributes >> >> Hello List >> >> I have a model with a set of one or more <sector/> elements where the sum >> of the sector/@percentage attributes should always equal 100. >> >> how do I express this as a bind constraint? >> >> Cheers >> >> Peter >> >> ____________________________________________________________ >> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! >> Check it out at http://www.inbox.com/earth >> >> >> >> ------------------------------------------------------------------------------ >> Get 100% visibility into Java/.NET code with AppDynamics Lite >> It's a free troubleshooting tool designed for production >> Get down to code-level detail for bottlenecks, with <2% overhead. >> Download for free and get started troubleshooting in minutes. >> http://p.sf.net/sfu/appdyn_d2d_ap2 >> _______________________________________________ >> Xsltforms-support mailing list >> Xsl...@li... >> https://lists.sourceforge.net/lists/listinfo/xsltforms-support > ____________________________________________________________ > GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys > Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails > > > > ------------------------------------------------------------------------------ > Get 100% visibility into Java/.NET code with AppDynamics Lite > It's a free troubleshooting tool designed for production > Get down to code-level detail for bottlenecks, with <2% overhead. > Download for free and get started troubleshooting in minutes. > http://p.sf.net/sfu/appdyn_d2d_ap2 > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support |
From: <fr...@fl...> - 2013-05-06 17:29:48
|
Hi Alain, I hit a possible issue with the combination of the context() and name() function. The example at https://github.com/AlainCouthures/xsltforms/blob/master/testsuite/XForms1.1/Edition1/Chapt07/7.10/7.10.4/7.10.4.a.xhtml works fine (obviously). Line 67 reads: <xforms:setvalue ref="instance('fruitInstance')/bad-fruit" value="context()" /> Clicking 'apple' returns 'apple'. If I replace in line 67 with <xforms:setvalue ref="instance('fruitInstance')/bad-fruit" value="name()" /> it still is ok. Clicking 'apple' returns 'bad-fruit'. If however I replace line 67 with <xforms:setvalue ref="instance('fruitInstance')/bad-fruit" value="context()/name()" /> I expect to see 'fruit' when I click 'apple', but XSLTForms returns a warning, and the return string is empty. The same problem occurs with local-name(). What can be the problem? Thanks, Fred van Blommestein |
From: Alain C. <ala...@ag...> - 2013-05-07 19:42:00
|
Hi Fred, > I hit a possible issue with the combination of the context() and > name() function. > > If however I replace line 67 with > <xforms:setvalue ref="instance('fruitInstance')/bad-fruit" > value="context()/name()" /> > I expect to see 'fruit' when I click 'apple', but XSLTForms returns a > warning, and the return string is empty. Because XSLTForms implements an XPath 1.0 engine, functions cannot be used within a path. > > The same problem occurs with local-name(). For both XPath 1.0 and XPath 2.0, name() and local-name() are functions which can have a node as parameter: "name(context())" and "local-name(context())" work as expected. Thank you for your feedbacks! -Alain |
From: <fr...@fl...> - 2013-05-08 07:48:55
|
Hi Alain, Thanks for the clarification, and the solution! Fred Citeren Alain Couthures <ala...@ag...>: > Hi Fred, > >> I hit a possible issue with the combination of the context() and >> name() function. >> >> If however I replace line 67 with >> <xforms:setvalue ref="instance('fruitInstance')/bad-fruit" >> value="context()/name()" /> >> I expect to see 'fruit' when I click 'apple', but XSLTForms returns a >> warning, and the return string is empty. > Because XSLTForms implements an XPath 1.0 engine, functions cannot > be used within a path. >> >> The same problem occurs with local-name(). > For both XPath 1.0 and XPath 2.0, name() and local-name() are > functions which can have a node as parameter: "name(context())" and > "local-name(context())" work as expected. > > Thank you for your feedbacks! > > -Alain > |