cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivelin Ivanov" <ive...@apache.org>
Subject Re: Dynamic SelectOnes in XMLForms
Date Fri, 06 Sep 2002 02:52:50 GMT

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


Mime
View raw message