[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

dynamically sort except first row if display=0

Subject: dynamically sort except first row if display=0
From: "Braumüller, Hans" <H.Braumueller@xxxxxxxxxxxx>
Date: Wed, 6 Nov 2002 12:09:23 +0100
row name
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:

Thanks,

Hans Braumüller 
Systementwickler Web-Design 
Hanse Orga AG


XML:

...
 <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> 
  <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>
  <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>
  </row>
...
</tabelle>    

XSL:
...
<xsl:apply-templates select="row">
  <xsl:sort select="col[@name='rowid']" order="ascending" data-type="number" />
</xsl:apply-templates>
...
...
<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:if>
...
  <xsl:apply-templates select="col" >
    <xsl:with-param name="row" select="$row"/>
  </xsl:apply-templates>
</tr>
</xsl:template>

JAVASCRIPT:
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.