[xsl] dynamically sort except first row if display=0

Subject: [xsl] dynamically sort except first row if display=0
From: "Braumüller, Hans" <H.Braumueller@xxxxxxxxxxxx>
Date: Wed, 6 Nov 2002 12:09:23 +0100
Hello friends,

maybe someone can forward me a tip.

I am sorting dynamically a table by the event onclick on a tableheader using Javascript.
My problem consist, that i use the first row as a invisible row, to store default values if there are, which i clone if a user want generate a new row in this table.

After sorting the table, this invisible row get sort, so my display of this table with alternating the rows with two colors get wrong, because the invisible are at the bottom or even inside the table. At default i sort by <col name=rowid> so the first invisble row are always at the top.

Is there a possibility to sort dynamically the table without the first row with the attribut display=none by DOM or innerHTML ? How must i configure my xsl or xml to get it work ?

Above the essential snippets:


Hans Braumüller 
Systementwickler Web-Design 
Hanse Orga AG


 <tabelle rows="6" cols="6">
  <row name="row-0" display="0">
   <col name="rowid"/>
   <col name="kennung"/>
   <col name="date"/>
   <col name="betrag"/>
   <col name="list1"/>
   <col name="checkBox"/>
  <row name="row-1">
   <col name="rowid"/>
   <col name="kennung">zz</col>
   <col name="date">01.01.2001</col>
   <col name="betrag">4711</col>
   <col name="list1">USD</col>
   <col name="checkBox">0</col>
  <row name="row-2">
   <col name="rowid"/>
   <col name="kennung">w</col>
   <col name="date">12.12.2002</col>
   <col name="betrag">47122</col>
   <col name="list1">EUR</col>
   <col name="checkBox">0</col>

<xsl:apply-templates select="row">
  <xsl:sort select="col[@name='rowid']" order="ascending" data-type="number" />
<xsl:template match="row">
  <xsl:variable name="row" select="count(preceding::row) " />
  <tr onmouseover="lightTableRow(this)" onclick="selectRow(this.id)">
  <xsl:if test="@display='0'">
   <xsl:attribute name="style">display:none</xsl:attribute>
  <xsl:apply-templates select="col" >
    <xsl:with-param name="row" select="$row"/>

xmlDoc = document.XMLDocument;
xslDoc = document.XSLDocument;

sortby = xslDoc.selectSingleNode("//xsl:sort/@select");
datatype = xslDoc.selectSingleNode("//xsl:sort/@data-type");
orderby  = xslDoc.selectSingleNode("//xsl:sort/@order");

function sort(field,format, tableId){
  output.innerHTML = xmlDoc.documentElement.transformNode(xslDoc);

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread