|
next
|
 Subject: Presenting values in a table using two dimension positions in the XML. Author: the man with zest Date: 07 Jun 2007 03:13 AM
|
Helllooooooo
Well, It worked A-ok.
I agree. It's a solution (that worked) for a specific case and with the timetable I had it was a good one.
I need to do a more generic solution (two nested recursive templates?) – don't worry I'm not afraid of brain-work… 
Yes. I draw an empty table (like a board of a game with 1-12 and A-H for example) , and in the beginning I've declared few variables:
<xsl:variable name="StartFromLeftPoint" select="29" />
<xsl:variable name="StartFromUpPoint" select="157" />
<xsl:variable name="ShiftFromLeftToRight" select="45" />
<xsl:variable name="ShiftFromUpToDown" select="45" />
Later in the code:
<table>
<tr>
<td>
<!-- printing the basic table -->
<xsl:call-template name="PrintTable"></xsl:call-template>
</td>
</tr>
<tr>
<td>
<!-- printing the data inside the table -->
<xsl:for-each select="TrayInfo/Sample/Request">
<xsl:variable name="CurrentTop" select="$StartFromUpPoint + (Row * $ShiftFromUpToDown) + Row "/>
<xsl:variable name="CurrentLeft" select="$StartFromLeftPoint + (Column * $ShiftFromLeftToRight) + Column "/>
<td align="center" bgcolor="green">
<xsl:attribute name="style">
<xsl:value-of select="concat('position: absolute; top:',concat($CurrentTop,'px;') ,' left: ' ,concat($CurrentLeft,'px;'))"/>
</xsl:attribute>
<xsl:value-of select="Result"/>
</td>
</xsl:for-each>
</td>
</tr>
</table>
The addition in the end of the variables CurrentTop and CurrentLeft are related to the shift of the borders that infect.
Kind Regards,
Elad Shapira ("Zest")
"Security, however, is an art, not a science." - RFC 3631.
|
|
|
|