xml - XSLT bug in Firefox? -


so have xml document describes table this

<section columns="1" id="2" name="datatable">     <datatable name="testdatatable">       <displayoptions column="1" />       <tableoptions appendable="true" />       <header name="tableheader">         <label iscurrency="false">unit</label>         <label iscurrency="false">type</label>         <label iscurrency="false">min</label>         <label iscurrency="false">max</label>         .... more label header       </header>                  <row>         <label>a unit</label>         <datafield id="312" name="unit1" controltype="text">                                    <fieldoptions visibility="true" iscurrency="false"/>          </datafield>         .... more datafield       </row>       ... more rows       <footer  name="tablefooter">         <label>total # of units:</label>         <label>0</label>         ... more label       </footer>  

and xslt stylesheet uses xml create table using html, this:

<xsl:template match="header"> <thead>   <xsl:for-each select="label">     <th class="datatableheader">       <xsl:variable name="currentposition" select="position() - 1"/>       <label>         <xsl:value-of select="self::node()"/>       </label>     </th>   </xsl:for-each> </thead> </xsl:template>    <xsl:template match="footer"> <tfoot>   <tr>       <xsl:for-each select="label">     <th class="datatablefooter">       <xsl:variable name="currentposition" select="position() - 1"/>       <label name="silly">         <xsl:value-of select="self::node()"/>       </label>     </th>   </xsl:for-each>   </tr>     </tfoot> </xsl:template>  <xsl:template match="row"> <tr class="tablerow">   <!-- apply template flag if there -->   <xsl:if test="@template = 'true'">     <xsl:attribute name="data-is-template" />   </xsl:if>   <!-- there should 1 label in each row -->   <xsl:if test="label">     <td class="datatablerowtitle">       <label for="{datafield[1]/@id}">         <xsl:value-of select="label"/>       </label>     </td>   </xsl:if>   <!-- apply datafield templates in table mode -->   <xsl:apply-templates select="datafield" mode="tableinput" /> </tr> </xsl:template>  <xsl:template match="label"> <xsl:value-of select="self::text()"/> </xsl:template> 

the problem xslt rendering tfooter row of tbody oppose making separate. checked html , tfooter child of tbody. happens in firefox; works great in other major broswers.

<td colspan="2">     <table class="datatable">                <thead>...</thead>                   <tbody>           <tr class="tablerow"></tr>           <tr class="tablerow"></tr>           <tr class="tablerow"></tr>           <tr class="tablerow"></tr>                             <tfoot>...</tfoot>       </tbody>      </table> </td> 

when check other browsers, find tfooter sibling of tbody , theader.

<td colspan="2">     <table class="datatable">                <thead>...</thead>                            <tbody>           <tr class="tablerow"></tr>           <tr class="tablerow"></tr>           <tr class="tablerow"></tr>           <tr class="tablerow"></tr>                                      </tbody>        <tfoot>...</tfoot>     </table> </td> 

so moved footer part in xml between header , row , works. tfooter sibling of tbody , theader, , before tbody.

 <td colspan="2">     <table class="datatable">                <thead>...</thead>        <tfoot>...</tfoot>                  <tbody>           <tr class="tablerow"></tr>           <tr class="tablerow"></tr>           <tr class="tablerow"></tr>           <tr class="tablerow"></tr>                                      </tbody>      </table> </td> 

so question why did firefox that? bug or firefox renders header , footer first before the row when creating table, have process header , footer first in xslt?

what looking @ html based on resultant dom xml generated xslt. important recognise source of document may altered when viewing dom, see in developer tools firefox's firebug or ie's f12.

for example, looking @ might last step in this:

input xml --[ xslt ]--> output html --[ browser api ]--> resultant dom 

if @ html4 spec, <tfoot> element must come before <tbody>, not after. the restriction changed in html5 , footer can come before or after body, when creating dom html document mozilla follows old rules valid. mozilla developers network page on <tfoot> has more info on got of links.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -