What is wrong with this?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

What is wrong with this?

danc-3
I have been having a lot of trouble with getting the xxforms:if to work and I think that I am just not doing it right.

Could someone please review the snippet below and tell me what is wrong with it?  The problem I am having is that I can never get the IF to evaluate to true (in the second paragraph).

Thanks!

- Dan


Snippet:

<xhtml:head>
    <xhtml:title>XForms Test</xhtml:title>
    <xforms:model>
        <xforms:instance id="instance">
            <form>
                <questions>
                    <question>
                        <number>1</number>
                        <text>question 1</text>
                        <answer yesno="no"/>
                    </question>
                    <question>
                        <number>2</number>
                        <text>question 2</text>
                        <answer yesno="yes"/>
                    </question>
                </questions>
            </form>
        </xforms:instance>
    </xforms:model>
</xhtml:head>
<xhtml:body>
    <xhtml:p>
        Value of answer/@yesno": <xforms:output ref="/form/questions/question[2]/answer/@yesno"/>
    </xhtml:p>
    <xhtml:p>
        <xxforms:if  test="/form/questions/question[2]/answer/@yesno = 'yes'">
            Finally, answer = 'yes'
        </xxforms:if>
    </xhtml:p>
</xhtml:body>




--
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
Reply | Threaded
Open this post in threaded view
|

RE: What is wrong with this?

Ryan Puddephatt
Hi Dan,
        You should have [1] instead of [2] as I believe XPath starts
counting at 0! Try that and see it that works

Ryan Puddephatt
Web Developer
TFX Group
1 Michaelson Square
Livingston
West Lothian
Scotand
EH54 7DP
 
* [hidden email]
( 01506 407 110
7  01506 407 108
 
-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: 18 November 2005 22:23
To: [hidden email]
Subject: [ops-users] What is wrong with this?

I have been having a lot of trouble with getting the xxforms:if to work and
I think that I am just not doing it right.

Could someone please review the snippet below and tell me what is wrong with
it?  The problem I am having is that I can never get the IF to evaluate to
true (in the second paragraph).

Thanks!

- Dan


Snippet:

<xhtml:head>
    <xhtml:title>XForms Test</xhtml:title>
    <xforms:model>
        <xforms:instance id="instance">
            <form>
                <questions>
                    <question>
                        <number>1</number>
                        <text>question 1</text>
                        <answer yesno="no"/>
                    </question>
                    <question>
                        <number>2</number>
                        <text>question 2</text>
                        <answer yesno="yes"/>
                    </question>
                </questions>
            </form>
        </xforms:instance>
    </xforms:model>
</xhtml:head>
<xhtml:body>
    <xhtml:p>
        Value of answer/@yesno": <xforms:output
ref="/form/questions/question[2]/answer/@yesno"/>
    </xhtml:p>
    <xhtml:p>
        <xxforms:if  test="/form/questions/question[2]/answer/@yesno =
'yes'">
            Finally, answer = 'yes'
        </xxforms:if>
    </xhtml:p>
</xhtml:body>






--
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