You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by u13209 <u1...@hs-harz.de> on 2002/09/05 09:04:11 UTC

Dynamic SelectOnes in XMLForms

Hello everybody and Hello to specially Ivelin,

i have a problem to create dynamic selectOnes in my
XMLForms with the <xf:repeat>. I looked on the source of 
XMLForm-Transformer and it seems to be not possible
with this Version. But this is importent to create powerfull
forms. I solved this problem with some additionals in
the xmlform2html.xsl and wizzard2html.xsl, but this is just
a workarround. How long will it take to change the transformer
to this functionality?? ( I hope tomorrow ;-) ).

... And here is my dirty workarround

wizzard2html.xsl
[..]
    <xsl:template match="xf:group[@type='selectOne']">
     <tr>
      <td><b><xsl:value-of select="xf:caption" /></b></td>
      <td align="left">
        <table cellspacing="0" cellpadding="0" border="0" class="plaintable">
         <tr>
          <td  align="left">
            <xsl:copy-of select="." />
          </td>
          <xsl:if test="xf:violation">
              <td align="left" class="{xf:violation[1]/@class}" width="100%">
                <xsl:for-each select="xf:violation">
                  * <xsl:value-of select="." />
                  <br/>
                </xsl:for-each>
              </td>
          </xsl:if>
         </tr>
        </table>
       </td>
      </tr>
    </xsl:template>
[...]

xmlform2html.xsl
[...]
   <xsl:template match="xf:group[@type='selectOne']">
     <select name="{@ref}" size="{@size}">
    <xsl:copy-of select="@*[not(name()='ref')]"/>
       <xsl:variable name="selected" select="//xf:output[@type='selection']/xf:value"/>
       <xsl:for-each select="xf:repeat/xf:group/option">
         <option value="{xf:output[@type='itemValue']/xf:value}">
           <xsl:if test="$selected = xf:output[@type='itemValue']/xf:value">
             <xsl:attribute name="selected"/>
           </xsl:if>
           <xsl:value-of select="xf:output[@type='itemCaption']/xf:value"/>
         </option>
       </xsl:for-each>
     </select>
   </xsl:template>  
[...]

in my xmlform i use something like this:
[...]
<xf:group ref="/attribute/preisinfoid" type="selectOne" size="10">
  <xf:caption>Sainsons</xf:caption>
  <xf:output type="selection" ref="/attribute/preisinfoid"/>
  <xf:repeat nodeset="/model/myCollection">
    <option>
     <xf:output type="itemValue"   ref="./preisinfoId"/>
     <xf:output type="itemCaption" ref="./preisInfoText"/>
    </option>
  </xf:repeat>
</xf:group> 
[...]

Re: Dynamic SelectOnes in XMLForms

Posted by Ivelin Ivanov <iv...@apache.org>.
Implementation now available in CVS HEAD for Cocoon 2.1.


----- Original Message -----
From: "Ivelin Ivanov" <iv...@apache.org>
To: <co...@xml.apache.org>; <co...@xml.apache.org>
Sent: Thursday, September 05, 2002 9:52 PM
Subject: Re: Dynamic SelectOnes in XMLForms


>
> This feature has been requested multiple times before.
>
> I was holding on an implementation until the W3C XForms spec it out.
>
> Now it is available at:
> http://www.w3.org/TR/xforms/slice9.html#ui-common-elements-itemset
>
> It should be relatively easy to implement provided the <xf:repeat> tag is
> very similar.
>
> I will not be able to work on this immediately.
>
> Would you be interested to contribute the patch ?
>
>
> Best,
>
> Ivelin
>
> ----- Original Message -----
> From: u13209
> To: cocoon-users@xml.apache.org
> Sent: Thursday, September 05, 2002 2:04 AM
> Subject: Dynamic SelectOnes in XMLForms
>
>
> Hello everybody and Hello to specially Ivelin,
>
> i have a problem to create dynamic selectOnes in my
> XMLForms with the <xf:repeat>. I looked on the source of
> XMLForm-Transformer and it seems to be not possible
> with this Version. But this is importent to create powerfull
> forms. I solved this problem with some additionals in
> the xmlform2html.xsl and wizzard2html.xsl, but this is just
> a workarround. How long will it take to change the transformer
> to this functionality?? ( I hope tomorrow ;-) ).
>
> ... And here is my dirty workarround
>
> wizzard2html.xsl
> [..]
>     <xsl:template match="xf:group[@type='selectOne']">
>      <tr>
>       <td><b><xsl:value-of select="xf:caption" /></b></td>
>       <td align="left">
>         <table cellspacing="0" cellpadding="0" border="0"
> class="plaintable">
>          <tr>
>           <td  align="left">
>             <xsl:copy-of select="." />
>           </td>
>           <xsl:if test="xf:violation">
>               <td align="left" class="{xf:violation[1]/@class}"
> width="100%">
>                 <xsl:for-each select="xf:violation">
>                   * <xsl:value-of select="." />
>                   <br/>
>                 </xsl:for-each>
>               </td>
>           </xsl:if>
>          </tr>
>         </table>
>        </td>
>       </tr>
>     </xsl:template>
> [...]
>
> xmlform2html.xsl
> [...]
>    <xsl:template match="xf:group[@type='selectOne']">
>      <select name="{@ref}" size="{@size}">
>     <xsl:copy-of select="@*[not(name()='ref')]"/>
>        <xsl:variable name="selected"
> select="//xf:output[@type='selection']/xf:value"/>
>        <xsl:for-each select="xf:repeat/xf:group/option">
>          <option value="{xf:output[@type='itemValue']/xf:value}">
>            <xsl:if test="$selected =
xf:output[@type='itemValue']/xf:value">
>              <xsl:attribute name="selected"/>
>            </xsl:if>
>            <xsl:value-of
select="xf:output[@type='itemCaption']/xf:value"/>
>          </option>
>        </xsl:for-each>
>      </select>
>    </xsl:template>
> [...]
>
> in my xmlform i use something like this:
> [...]
> <xf:group ref="/attribute/preisinfoid" type="selectOne" size="10">
>   <xf:caption>Sainsons</xf:caption>
>   <xf:output type="selection" ref="/attribute/preisinfoid"/>
>   <xf:repeat nodeset="/model/myCollection">
>     <option>
>      <xf:output type="itemValue"   ref="./preisinfoId"/>
>      <xf:output type="itemCaption" ref="./preisInfoText"/>
>     </option>
>   </xf:repeat>
> </xf:group>
> [...]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: Dynamic SelectOnes in XMLForms

Posted by Ivelin Ivanov <iv...@apache.org>.
This feature has been requested multiple times before.

I was holding on an implementation until the W3C XForms spec it out.

Now it is available at:
http://www.w3.org/TR/xforms/slice9.html#ui-common-elements-itemset

It should be relatively easy to implement provided the <xf:repeat> tag is
very similar.

I will not be able to work on this immediately.

Would you be interested to contribute the patch ?


Best,

Ivelin

----- Original Message -----
From: u13209
To: cocoon-users@xml.apache.org
Sent: Thursday, September 05, 2002 2:04 AM
Subject: Dynamic SelectOnes in XMLForms


Hello everybody and Hello to specially Ivelin,

i have a problem to create dynamic selectOnes in my
XMLForms with the <xf:repeat>. I looked on the source of
XMLForm-Transformer and it seems to be not possible
with this Version. But this is importent to create powerfull
forms. I solved this problem with some additionals in
the xmlform2html.xsl and wizzard2html.xsl, but this is just
a workarround. How long will it take to change the transformer
to this functionality?? ( I hope tomorrow ;-) ).

... And here is my dirty workarround

wizzard2html.xsl
[..]
    <xsl:template match="xf:group[@type='selectOne']">
     <tr>
      <td><b><xsl:value-of select="xf:caption" /></b></td>
      <td align="left">
        <table cellspacing="0" cellpadding="0" border="0"
class="plaintable">
         <tr>
          <td  align="left">
            <xsl:copy-of select="." />
          </td>
          <xsl:if test="xf:violation">
              <td align="left" class="{xf:violation[1]/@class}"
width="100%">
                <xsl:for-each select="xf:violation">
                  * <xsl:value-of select="." />
                  <br/>
                </xsl:for-each>
              </td>
          </xsl:if>
         </tr>
        </table>
       </td>
      </tr>
    </xsl:template>
[...]

xmlform2html.xsl
[...]
   <xsl:template match="xf:group[@type='selectOne']">
     <select name="{@ref}" size="{@size}">
    <xsl:copy-of select="@*[not(name()='ref')]"/>
       <xsl:variable name="selected"
select="//xf:output[@type='selection']/xf:value"/>
       <xsl:for-each select="xf:repeat/xf:group/option">
         <option value="{xf:output[@type='itemValue']/xf:value}">
           <xsl:if test="$selected = xf:output[@type='itemValue']/xf:value">
             <xsl:attribute name="selected"/>
           </xsl:if>
           <xsl:value-of select="xf:output[@type='itemCaption']/xf:value"/>
         </option>
       </xsl:for-each>
     </select>
   </xsl:template>
[...]

in my xmlform i use something like this:
[...]
<xf:group ref="/attribute/preisinfoid" type="selectOne" size="10">
  <xf:caption>Sainsons</xf:caption>
  <xf:output type="selection" ref="/attribute/preisinfoid"/>
  <xf:repeat nodeset="/model/myCollection">
    <option>
     <xf:output type="itemValue"   ref="./preisinfoId"/>
     <xf:output type="itemCaption" ref="./preisInfoText"/>
    </option>
  </xf:repeat>
</xf:group>
[...]


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: Dynamic SelectOnes in XMLForms

Posted by Ivelin Ivanov <iv...@apache.org>.
This feature has been requested multiple times before.

I was holding on an implementation until the W3C XForms spec it out.

Now it is available at:
http://www.w3.org/TR/xforms/slice9.html#ui-common-elements-itemset

It should be relatively easy to implement provided the <xf:repeat> tag is
very similar.

I will not be able to work on this immediately.

Would you be interested to contribute the patch ?


Best,

Ivelin

----- Original Message -----
From: u13209
To: cocoon-users@xml.apache.org
Sent: Thursday, September 05, 2002 2:04 AM
Subject: Dynamic SelectOnes in XMLForms


Hello everybody and Hello to specially Ivelin,

i have a problem to create dynamic selectOnes in my
XMLForms with the <xf:repeat>. I looked on the source of
XMLForm-Transformer and it seems to be not possible
with this Version. But this is importent to create powerfull
forms. I solved this problem with some additionals in
the xmlform2html.xsl and wizzard2html.xsl, but this is just
a workarround. How long will it take to change the transformer
to this functionality?? ( I hope tomorrow ;-) ).

... And here is my dirty workarround

wizzard2html.xsl
[..]
    <xsl:template match="xf:group[@type='selectOne']">
     <tr>
      <td><b><xsl:value-of select="xf:caption" /></b></td>
      <td align="left">
        <table cellspacing="0" cellpadding="0" border="0"
class="plaintable">
         <tr>
          <td  align="left">
            <xsl:copy-of select="." />
          </td>
          <xsl:if test="xf:violation">
              <td align="left" class="{xf:violation[1]/@class}"
width="100%">
                <xsl:for-each select="xf:violation">
                  * <xsl:value-of select="." />
                  <br/>
                </xsl:for-each>
              </td>
          </xsl:if>
         </tr>
        </table>
       </td>
      </tr>
    </xsl:template>
[...]

xmlform2html.xsl
[...]
   <xsl:template match="xf:group[@type='selectOne']">
     <select name="{@ref}" size="{@size}">
    <xsl:copy-of select="@*[not(name()='ref')]"/>
       <xsl:variable name="selected"
select="//xf:output[@type='selection']/xf:value"/>
       <xsl:for-each select="xf:repeat/xf:group/option">
         <option value="{xf:output[@type='itemValue']/xf:value}">
           <xsl:if test="$selected = xf:output[@type='itemValue']/xf:value">
             <xsl:attribute name="selected"/>
           </xsl:if>
           <xsl:value-of select="xf:output[@type='itemCaption']/xf:value"/>
         </option>
       </xsl:for-each>
     </select>
   </xsl:template>
[...]

in my xmlform i use something like this:
[...]
<xf:group ref="/attribute/preisinfoid" type="selectOne" size="10">
  <xf:caption>Sainsons</xf:caption>
  <xf:output type="selection" ref="/attribute/preisinfoid"/>
  <xf:repeat nodeset="/model/myCollection">
    <option>
     <xf:output type="itemValue"   ref="./preisinfoId"/>
     <xf:output type="itemCaption" ref="./preisInfoText"/>
    </option>
  </xf:repeat>
</xf:group>
[...]


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>