Here are two patches for xsltforms-523:

- for select/optgroup (one level) support; now working in Chrome as well (removed a stray xhtml namespace-prefixed 'opgroup' element). - for table/group expanding into the correct table child element instead of div.

Leigh.

Changes from xsltforms-522.zip:

1. table/group and table/*/group now expand into thead|tbody|tr|th instead of 
div.
2. select1/choices and select/choices now expands into optgroup, for one level 
of choices.  multi-level choices is not supported.

--- xsltforms-523/xsltforms.xsl 2012-02-01 14:17:22.000000000 -0800
+++ xsltforms-523-xerox-1/xsltforms.xsl 2012-02-01 14:53:23.691627710 -0800
@@ -1,3 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!-- Rev. 523
 Copyright (C) 2008-2012 agenceXML - Alain COUTHURES
@@ -996,5 +996,16 @@
                                                                <xsl:attribute 
name="multiple">true</xsl:attribute>
                                                        </xsl:if>
-                                                       <xsl:apply-templates 
select="xforms:item|xforms:itemset|xforms:choices/*"/>
+                                                        <xsl:for-each 
select="xforms:item|xforms:itemset|xforms:choices">
+                                                          <xsl:choose>
+                                                            <xsl:when 
test="local-name()='choices'">
+                                                              <optgroup 
label="{xforms:label/text()}">
+                                                                
<xsl:apply-templates select="xforms:item|xforms:itemset"/>
+                                                              </optgroup>
+                                                            </xsl:when>
+                                                            <xsl:otherwise>
+                                                              
<xsl:apply-templates select="."/>
+                                                            </xsl:otherwise>
+                                                          </xsl:choose>
+                                                        </xsl:for-each>
                                                </select>
                                        </xsl:when>
@@ -1002,12 +1013,26 @@
                                                <span>
                                                        <xsl:call-template 
name="comun"/>
-                                                       <xsl:apply-templates 
select="xforms:item|xforms:itemset|xforms:choices/*">
-                                                               <xsl:with-param 
name="type">
-                                                                       
<xsl:choose>
-                                                                               
<xsl:when test="local-name() = 'select'">checkbox</xsl:when>
-                                                                               
<xsl:otherwise>radio</xsl:otherwise>
-                                                                       
</xsl:choose>
-                                                               
</xsl:with-param> 
-                                                       </xsl:apply-templates>
+                                                        <xsl:variable 
name="type">
+                                                          <xsl:choose>
+                                                            <xsl:when 
test="local-name() = 'select'">checkbox</xsl:when>
+                                                            
<xsl:otherwise>radio</xsl:otherwise>
+                                                          </xsl:choose>
+                                                        </xsl:variable>
+                                                        <xsl:for-each 
select="xforms:item|xforms:itemset|xforms:choices">
+                                                          <xsl:choose>
+                                                            <xsl:when 
test="local-name(.)='choices'">
+                                                              <optgroup 
label="{xforms:label/text()}">
+                                                                
<xsl:apply-templates select="xforms:item|xforms:itemset">
+                                                                  
<xsl:with-param name="type" select="$type" />
+                                                                
</xsl:apply-templates>
+                                                              </optgroup>
+                                                            </xsl:when>
+                                                            <xsl:otherwise>
+                                                              
<xsl:apply-templates select=".">
+                                                                
<xsl:with-param name="type" select="$type" />
+                                                              
</xsl:apply-templates>
+                                                            </xsl:otherwise>
+                                                          </xsl:choose>
+                                                        </xsl:for-each>
                                                </span>
                                        </xsl:when>
@@ -1021,5 +1046,16 @@
                                                                </xsl:attribute>
                                                        </xsl:if>
-                                                       <xsl:apply-templates 
select="xforms:item|xforms:itemset|xforms:choices/*"/>
+                                                        <xsl:for-each 
select="xforms:item|xforms:itemset|xforms:choices">
+                                                          <xsl:choose>
+                                                            <xsl:when 
test="local-name()='choices'">
+                                                              <optgroup 
label="{xforms:label/text()}">
+                                                                
<xsl:apply-templates select="xforms:item|xforms:itemset" />
+                                                              </optgroup>
+                                                            </xsl:when>
+                                                            <xsl:otherwise>
+                                                              
<xsl:apply-templates select="." />
+                                                            </xsl:otherwise>
+                                                          </xsl:choose>
+                                                        </xsl:for-each>
                                                </select>
                                        </xsl:otherwise>
@@ -1396,5 +1432,16 @@
                                </xsl:when>
                                <xsl:otherwise>
-                                       <div>
+                                        <xsl:variable name="mainelt">
+                                          <xsl:choose>
+                                            <xsl:when 
test="parent::*[local-name()='table']">tbody</xsl:when>
+                                            <xsl:when 
test="parent::*[local-name()='thead']">thead</xsl:when>
+                                            <xsl:when 
test="parent::*[local-name()='tbody']">tbody</xsl:when>
+                                            <xsl:when 
test="parent::*[local-name()='tfoot']">tfoot</xsl:when>
+                                            <xsl:when 
test="parent::*[local-name()='tr']">tr</xsl:when>
+                                            <xsl:otherwise>div</xsl:otherwise>
+                                          </xsl:choose>
+                                        </xsl:variable>
+
+                                        <xsl:element name="{$mainelt}">
                                                <xsl:call-template 
name="genid"/>
                                                <xsl:call-template name="style">
@@ -1412,5 +1459,5 @@
                                                        </xsl:apply-templates>
                                                </div>
-                                       </div>
+                                       </xsl:element>
                                </xsl:otherwise>
                        </xsl:choose>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to