You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2004/08/13 14:39:41 UTC

Forms Editor: Inserting missing attributes

Hi Lenya developers,

I want to make an attribute with the values "true" and "false"
editable using a combo box (<xhtml:select>). The attribute is
optional, when it is missing the value is interpreted as "false".

So I want to display a combo box in each case (whether the attribute
is present or not).

I'm using the following code, which works fine if the attribute
exists. But the attribute is not created if it didn't exist
before ...

Any ideas what I'm doing wrong?

     <content>
       Abstracts:

       <xsl:choose>

         <!-- Attribute exists: update -->
         <xsl:when test="@abstracts">
           <select name="&lt;xupdate:update 
select=&quot;/*/xhtml:body/unizh:children[@tagID='{@tagID}']/@abstracts&quot;&gt;">
             <xsl:choose>
               <xsl:when test="@abstracts = 'true'">
                 <option value="true" selected="selected">true</option>
                 <option value="false">false</option>
               </xsl:when>
               <xsl:otherwise>
                 <option value="true">true</option>
                 <option value="false" selected="selected">false</option>
               </xsl:otherwise>
             </xsl:choose>
           </select>
         </xsl:when>

         <!-- Attribute does not exist: insert -->
         <xsl:otherwise>
           <select name="&lt;xupdate:insert 
select=&quot;/*/xhtml:body/unizh:children[@tagID='{@tagID}']/@abstracts&quot;&gt;">
             <option value="true">true</option>
             <option value="false" selected="selected">false</option>
           </select>
         </xsl:otherwise>

       </xsl:choose>
     </content>


Thanks in advance!

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org