xforms-element-218 xforms:switch does not contain at least one xforms:case for switch id: xforms-element-218

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

xforms-element-218 xforms:switch does not contain at least one xforms:case for switch id: xforms-element-218

vernekap
Hi

I need to show tabs(widget:tab) conditionally. I tried to put the tab inside an xforms:group and put a ref to boolean variable.

When I add xforms:group programmatically, I get following error in the browser(with a stack trace- but without line number of xhtml):

xforms:switch does not contain at least one xforms:case for switch id: xforms-element-218.

I have attached my partial xhtml to this post. xforms-group-conditional.txt

I know there is something wrong. But I want to know

1. how to use stack trace to locate error?
2. How to shorten my development / test cycle? Can I run filter to validate xhtml as junit test case?


with regards
Pralhad
Reply | Threaded
Open this post in threaded view
|

Re: xforms-element-218 xforms:switch does not contain at least one xforms:case for switch id: xforms-element-218

Alessandro Vernet
Administrator
Pralhad,

On Wed, Apr 22, 2009 at 6:30 AM, vernekap <[hidden email]> wrote:
> I need to show tabs(widget:tab) conditionally. I tried to put the tab inside
> an xforms:group and put a ref to boolean variable.

widget:tab is implemented in XSLT (in xforms-widgets.xsl).
Essentially, it transforms what you write in XForms, and doesn't
support "optional tabs" (tabs which are to be included or not
depending on some condition). It was done a long time ago, well before
we had a implementation of XBL in Orbeon Forms. Now it should be
rewritten in XBL, and it would then be easy for the component to
support optional tabs.

If you are interested in doing this, you can have a look at other
existing XBL components which you will find inside
orbeon-resources-private.jar under the xbl directory. Following the
same structure and putting the files in your resources you can create
an fr:tab component. If you are interested in doing this, and would
like some additional pointers, just let us know.

> 1. how to use stack trace to locate error?

Make sure you have "tail" program (such as BareTail on Windows
http://www.baremetalsoft.com/baretail/ or "tail -f" on UNIX) running
at all time to view the orbeon.log. If you don't see an orbeon.log,
check the path to that file in your config/log4j.xml.

> 2. How to shorten my development / test cycle? Can I run filter to validate
> xhtml as junit test case?

For validation, I use a schema-aware XML editor (in my case IntelliJ),
and set it up to use schemas bundled with Orbeon Forms for XHTML,
XForms, XSLT, ... (you can see those XSD files here:
http://cvs.forge.objectweb.org/cgi-bin/viewcvs.cgi/ops/orbeon/src/java/org/orbeon/oxf/xml/schemas/).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


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

Re: xforms-element-218 xforms:switch does not contain at least one xforms:case for switch id: xforms-element-218

vernekap
Hi Alex

I am trying to implement widget:tabs and widget:tab using xbl.

I have looked button.xbl and YUI control tabview
(http://developer.yahoo.com/yui/examples/tabview/frommarkup.html)

My idea at this time is to use YUI tabview for this. Please let me know if you have thought about some other way of implementing it.

with regards
Pralhad



Alessandro Vernet wrote
Pralhad,

On Wed, Apr 22, 2009 at 6:30 AM, vernekap <vernekap@gmail.com> wrote:
> I need to show tabs(widget:tab) conditionally. I tried to put the tab inside
> an xforms:group and put a ref to boolean variable.

widget:tab is implemented in XSLT (in xforms-widgets.xsl).
Essentially, it transforms what you write in XForms, and doesn't
support "optional tabs" (tabs which are to be included or not
depending on some condition). It was done a long time ago, well before
we had a implementation of XBL in Orbeon Forms. Now it should be
rewritten in XBL, and it would then be easy for the component to
support optional tabs.

If you are interested in doing this, you can have a look at other
existing XBL components which you will find inside
orbeon-resources-private.jar under the xbl directory. Following the
same structure and putting the files in your resources you can create
an fr:tab component. If you are interested in doing this, and would
like some additional pointers, just let us know.

> 1. how to use stack trace to locate error?

Make sure you have "tail" program (such as BareTail on Windows
http://www.baremetalsoft.com/baretail/ or "tail -f" on UNIX) running
at all time to view the orbeon.log. If you don't see an orbeon.log,
check the path to that file in your config/log4j.xml.

> 2. How to shorten my development / test cycle? Can I run filter to validate
> xhtml as junit test case?

For validation, I use a schema-aware XML editor (in my case IntelliJ),
and set it up to use schemas bundled with Orbeon Forms for XHTML,
XForms, XSLT, ... (you can see those XSD files here:
http://cvs.forge.objectweb.org/cgi-bin/viewcvs.cgi/ops/orbeon/src/java/org/orbeon/oxf/xml/schemas/).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws


-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
Reply | Threaded
Open this post in threaded view
|

Re: xforms-element-218 xforms:switch does not contain at least one xforms:case for switch id: xforms-element-218

vernekap

Hi Alex

(I have added this message as xbl-tabview.txt as well)

I am stuck with a design problem while trying to create xbl for tabview - specifically with YUI Tab component which has 2 components to add.


I am planning to use YUI TabView and Tab. TabView and Tab can be added as HTML or can be added dynamically through javascript.

In case of dynamic addition code looks like this:

------------------
tabView.addTab( new YAHOO.widget.Tab({
            label: 'ipsum',
            content: '<ul><li>Lorem ipsum dolor sit amet.</li><li>Lorem ipsum dolor sit amet.</li><li>Lorem ipsum dolor sit amet.</li><li>Lorem ipsum dolor sit amet.</li></ul>'
         
        }));
------------------

My content part would contain xforms tags - which would require ops transformation, hence dynamic addition of tabs is ruled out.

So I decided I would have to add all tabs with content on the server side and on browser side do a dynamic addition and deletion (with some caching for performance).

Now comes the XBL part.

For static addition (at html body level), I would need a structure like:

        <xhtml:div id="demo" class="yui-navset">
                <xhtml:ul class="yui-nav">
                        <xhtml:li id="li.1">
                                <em>Tab One Label</em>
                        </xhtml:li>
                        <xhtml:li class="selected" id="li.2">
                                <em>Tab Two Label</em>
                        </xhtml:li>
                        <xhtml:li id="li.3">
                                <em>Tab Three Label</em>
                        </xhtml:li>
                </xhtml:ul>
                <xhtml:div class="yui-content">
                        <xhtml:div id="tab1">
                                <p>Tab One Content</p>
                        </xhtml:div>
                        <xhtml:div id="tab2">
                                <p>Tab Two Content</p>
                        </xhtml:div>
                        <xhtml:div id="tab3">
                                <p>Tab Three Content</p>
                        </xhtml:div>
                </xhtml:div>
        </xhtml:div>

of which TabView structure would be:

        <xhtml:div id="demo" class="yui-navset">
                <xhtml:ul class="yui-nav">
                </xhtml:ul>
                <xhtml:div class="yui-content">
                </xhtml:div>
        </xhtml:div>

which I think I can manage in XBL.

However, for tab I need to add 2 separate components at different places.

                        <xhtml:li id="li.1">
                                <em>Tab One Label</em>
                        </xhtml:li>

                        <xhtml:div id="tab1">
                                <p>Tab One Content</p>
                        </xhtml:div>


I am struggling with this now - that in xbl:template section of tab-binding, how do I specify that there are 2 components to add at separate places?

Can you provide with some input to start with ?

with regards
Pralhad

vernekap wrote
Hi Alex

I am trying to implement widget:tabs and widget:tab using xbl.

I have looked button.xbl and YUI control tabview
(http://developer.yahoo.com/yui/examples/tabview/frommarkup.html)

My idea at this time is to use YUI tabview for this. Please let me know if you have thought about some other way of implementing it.

with regards
Pralhad



Alessandro Vernet wrote
Pralhad,

On Wed, Apr 22, 2009 at 6:30 AM, vernekap <vernekap@gmail.com> wrote:
> I need to show tabs(widget:tab) conditionally. I tried to put the tab inside
> an xforms:group and put a ref to boolean variable.

widget:tab is implemented in XSLT (in xforms-widgets.xsl).
Essentially, it transforms what you write in XForms, and doesn't
support "optional tabs" (tabs which are to be included or not
depending on some condition). It was done a long time ago, well before
we had a implementation of XBL in Orbeon Forms. Now it should be
rewritten in XBL, and it would then be easy for the component to
support optional tabs.

If you are interested in doing this, you can have a look at other
existing XBL components which you will find inside
orbeon-resources-private.jar under the xbl directory. Following the
same structure and putting the files in your resources you can create
an fr:tab component. If you are interested in doing this, and would
like some additional pointers, just let us know.

> 1. how to use stack trace to locate error?

Make sure you have "tail" program (such as BareTail on Windows
http://www.baremetalsoft.com/baretail/ or "tail -f" on UNIX) running
at all time to view the orbeon.log. If you don't see an orbeon.log,
check the path to that file in your config/log4j.xml.

> 2. How to shorten my development / test cycle? Can I run filter to validate
> xhtml as junit test case?

For validation, I use a schema-aware XML editor (in my case IntelliJ),
and set it up to use schemas bundled with Orbeon Forms for XHTML,
XForms, XSLT, ... (you can see those XSD files here:
http://cvs.forge.objectweb.org/cgi-bin/viewcvs.cgi/ops/orbeon/src/java/org/orbeon/oxf/xml/schemas/).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws


-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
Reply | Threaded
Open this post in threaded view
|

Re: xforms-element-218 xforms:switch does not contain at least one xforms:case for switch id: xforms-element-218

Alessandro Vernet
Administrator
Pralhad,

vernekap wrote
However, for tab I need to add 2 separate components at different places.

                        <xhtml:li id="li.1">
                                <em>Tab One Label</em>
                        </xhtml:li>

                        <xhtml:div id="tab1">
                                <p>Tab One Content</p>
                        </xhtml:div>


I am struggling with this now - that in xbl:template section of tab-binding, how do I specify that there are 2 components to add at separate places?
This is a tricky one. We just talked about this one with Erik, and most likely you'll need to use XSLT for this (with <xbl:template xxbl:transform="oxf:xslt">, see: http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components-guide#TOC-xbl:template-xxbl:transform-attribu). Assuming you have a repeat-nodeset on your <fr:tab> to support repeats of tabs, the XBL component would contain code that looks like:

<ul>
    <xsl:for-each select="fr:tab">
        <xsl:choose>
            <xsl:when test="@repeat-nodeset">
                <xforms:repeat nodeset="{@repeat-nodeset}">
                    <li>
                        <xsl:copy-of select="xforms:label"/>
                    </li>
                </xforms:repeat>
            </xsl:when>
            <xsl:otherwise>
                <li>
                    <xsl:copy-of select="xforms:label"/>
                </li>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:for-each>
</ul>
<ul>
    <xsl:for-each select="fr:tab">
        <xsl:choose>
            <xsl:when test="@repeat-nodeset">
                <xforms:repeat nodeset="{@repeat-nodeset}">
                    <li>
                        <xsl:copy-of select="fr:content/node()"/>
                    </li>
                </xforms:repeat>
            </xsl:when>
            <xsl:otherwise>
                <li>
                    <xsl:copy-of select="fr:content/node()"/>
                </li>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:for-each>
</ul>

As I said, this is a really tricky one. So if you get stuck at some point with this, just attach your XBL file, and we can have a look at it.

Alex