[xsl] generic grid

Subject: [xsl] generic grid
From: <viniciuscamara@xxxxxxxxxxxx>
Date: Fri, 12 May 2006 15:20:06 -0300
Hello Fellows,
I'm trying to dev a generic gridline using xsl.
How the better way to do this?

I want that my xslt receive how xml node will be part of my grid.
See the xml below:

<grausDesempenho total=\"2\">
<grauDesempenho id=\"1\" codGrauDesempenho=\"\" codIndicador=\"\">
 <nmeGrauDesempenho>Venda de cartues</nmeGrauDesempenho>
 <vlrMinimo>1</vlrMinimo>
 <vlrMaximo>4</vlrMaximo>
 <vlrCor>003399</vlrCor>
 <tmpRecuperacao></tmpRecuperacao>
</grauDesempenho>
<grauDesempenho  id=\"2\" codGrauDesempenho=\"\" codIndicador=\"\">
 <nmeGrauDesempenho>Tempo midio de pausa</nmeGrauDesempenho>
 <vlrMinimo>1</vlrMinimo>
 <vlrMaximo>100</vlrMaximo>
 <vlrCor>cfcfcf</vlrCor>
 <tmpRecuperacao></tmpRecuperacao>
</grauDesempenho>
</grausDesempenho>

I want to my generic grid receive any xml file and by params I specified which colums I want to show.

May I pass by param with comma separated what nodes I want to show? (One Idea) Or, is better determine the number max of params to my xsl to construct this?

How to pass to my xsl which nodes I want to process?

I know that I can do to one xsl file to one xml file to transform them. So I want to economize time and develop some idea reusable.

May I clear? I hope so.

See below the example of xsl normal grid:

<?xml version='1.0' encoding="ISO8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:template match="/">


<xsl:choose>
<xsl:when test="grausDesempenho/@total>0">
<div id="lista" style="overflow:-moz-scrollbars-vertical;width:100%;height:80px">
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="resultSet">
<tr class="resultSetHeader">
<th style="width:300px;height:20px;">Nome</th>
<th style="width:120px;height:20px;">Valor Mmnimo</th>
<th style="width:120px;height:20px;">Valor Maximo</th>
<th style="width:90px;height:20px;"></th>
</tr>


<xsl:for-each select="grausDesempenho/grauDesempenho">
<tr id="GRAUDESEMPENHO_{@id}" value="1" style="height:20px;" class="resultSet hand">
<td style="width:300px;"><xsl:value-of select="nmeGrauDesempenho" /></td>
<td style="text-align:center;width:130px;"><xsl:value-of select="vlrMinimo" /></td>
<td style="text-align:center;width:130px;"><xsl:value-of select="vlrMaximo" /></td>
<td style="text-align:center;width:55px;"><img onclick="editar();" src="images/common/icons/edit.gif" align="absmiddle" class="toolbar hand"/>&#160;<img onclick="excluir();" src="images/common/icons/delete.gif" align="absmiddle" class="toolbar hand"/></td>
</tr>
</xsl:for-each>
</table>
</div>
</xsl:when>
<xsl:otherwise>
Ops!
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>


Thanks so much,
Have a nice weekend.


Vinicius Cbmara viniciuscamara@xxxxxxxxxxxx



_______________________________________________________ Abra sua conta no Yahoo! Mail: 1GB de espago, alertas de e-mail no celular e anti-spam realmente eficaz. http://br.info.mail.yahoo.com/


Current Thread