xsl(t) view in 3.0

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

xsl(t) view in 3.0

Smith, Donald

I have a 2.8 view with something like this in the form:

 

<instance>

  <property datatype=”Boolean” label=”open source’ />

</instance>

 

The key point is that the datatype could be one of several things: Boolean, string, date, etc., but each different datatype value requires different kinds of xforms interface in my view. So on my (2.8) page, I set up an <xsl:choose> to account for each possible type of datatype, which then provides the appropriate xforms controls for that datatype, but doesn’t present the inappropriate ones.

 

<xsl:choose>

<xsl:when test=”/instance/property/@datatype = ‘boolean’”>

  <!—xforms controls appropriate for Booleans à

</when>

<xsl:when test=”/instance/property/@datatype = ‘string’”>

  <!—xforms controls appropriate for stings à

</when>

<!—and so on à

</xsl:choose>

 

We’re migrating to 3.0 and this no longer works. All the xform content of the <xsl:choose> renders on the page.

 

How can this be done, using either XSLT or XForms? From the examples of XForms switches that I’ve looked at, it’s not clear to me that they can react like an XSLT choose in presenting one case among the others based only on specific content of the form (but maybe I’m wrong and switch cases can use XPath expressions to test for true conditions and fire whenever they are true).

 

Any insights are appreciated.

 

Thanks,

 

Don



--
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: xsl(t) view in 3.0

Erik Bruchez
Administrator
Smith, Donald wrote:

 > How can this be done, using either XSLT or XForms? From the examples of
 > XForms switches that I$(Bve(B looked at, it$(Bs (Bnot clear to me
that they can
 > react like an XSLT choose in presenting one case among the others based
 > only on specific content of the form (but maybe I$(Bm (Bwrong and
switch
 > cases can use XPath expressions to test for true conditions and fire
 > whenever they are true).

You wouldn't use XSLT if the content of your XForms instance can
change while the use is interacting with the page, because XSLT will
run once only upon page initialization, when the page is sent to the
browser.

But you can do this with XForms, using relevance. Create a
control instance:

<xforms:instance id="control-instance">
   <control xmlns="">
     <group-1/>
     <group-2/>
     ...
   </control>
</xforms:instance>

Use xforms:bind to assign relevance to the elements:

<xforms:bind nodeset="instance('control-instance')/group-1"
   relevant="instance('main-instance')/property = 'Boolean'"/>
<xforms:bind nodeset="instance('control-instance')/group-2"
   relevant="instance('main-instance')/property = 'String'"/>
...

Then use groups as follows:

<xforms:group ref="instance('control-instance')/group-1">
   ... Boolean controls ...
</xforms:group>

<xforms:group ref="instance('control-instance')/group-2">
   ... String controls ...
</xforms:group>

-Erik




--
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: xsl(t) view in 3.0

Smith, Donald
In reply to this post by Smith, Donald
Thanks Erik. Works great.

Don

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: Thursday, February 02, 2006 6:09 PM
To: [hidden email]
Subject: Re: [ops-users] xsl(t) view in 3.0

Smith, Donald wrote:

 > How can this be done, using either XSLT or XForms? From the examples
of
 > XForms switches that I$(Bve(B looked at, it$(Bs (Bnot clear to me

that they can
 > react like an XSLT choose in presenting one case among the others
based
 > only on specific content of the form (but maybe I$(Bm (Bwrong and
switch
 > cases can use XPath expressions to test for true conditions and fire
 > whenever they are true).

You wouldn't use XSLT if the content of your XForms instance can
change while the use is interacting with the page, because XSLT will
run once only upon page initialization, when the page is sent to the
browser.

But you can do this with XForms, using relevance. Create a
control instance:

<xforms:instance id="control-instance">
   <control xmlns="">
     <group-1/>
     <group-2/>
     ...
   </control>
</xforms:instance>

Use xforms:bind to assign relevance to the elements:

<xforms:bind nodeset="instance('control-instance')/group-1"
   relevant="instance('main-instance')/property = 'Boolean'"/>
<xforms:bind nodeset="instance('control-instance')/group-2"
   relevant="instance('main-instance')/property = 'String'"/>
...

Then use groups as follows:

<xforms:group ref="instance('control-instance')/group-1">
   ... Boolean controls ...
</xforms:group>

<xforms:group ref="instance('control-instance')/group-2">
   ... String controls ...
</xforms:group>

-Erik






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