Hi Mukul
This is my XML file
----------------------
<html>
<body>
<h1>FCC and IEEE Regulations</h1>
<p>Table 1.3 shows the relative FCC and IEEE power output limits.</p>
<table border="0" cellspacing="0" cellpadding="1" width="90%">
<thead>
<tr>
<th valign="top" colspan="3">Table 1.3 802.11a Power Output Limits</th></tr>
<tr>
<th valign="top"><b>Spectrum Range</b></th>
<th valign="top"><b>FCC Limit</b></th>
<th valign="top"><b>IEEE Limit</b></th></tr>
</thead>
<tbody>
<tr><td valign="top">5.15 GHz–5.25 GHz</td>
<td valign="top">5.15 GHz–5.25 GHz</td>
<td valign="top">40 mW</td></tr>
<tr><td valign="top">5.25 GHz–5.35 GHz</td>
<td valign="top">200 mW</td>
<td valign="top">250 mW</td></tr>
<tr><td valign="top">5.725 GHz–5.825 GHz</td>
<td valign="top">800 mW</td>
<td valign="top">1,000 mW</td></tr>
</tbody>
</table>
</body>
</html>
XSL file
-----------------
<xsl:transform xmlns:gale="http://www.gale.com/eBooks"
xmlns:gale="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon" version="1.1"
exclude-result-prefixes="gale" extension-element-prefixes="saxon">
<xsl:param name="saxon.character.representation" select="decimal" />
<xsl:output saxon:character-representation="'entity;decimal'" method="xml"
encoding="US-ASCII"
indent="yes" />
<xsl:template match="/">
<document>
<xsl:apply-templates select="html"/>
</document>
</xsl:template>
<xsl:template match="body">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="h1">
<title><xsl:apply-templates/></title>
</xsl:template>
<xsl:template match="p">
<xsl:element name="para">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="table">
<table>
<table.html frame="void" width="100%" rules="groups" align="left" />
<xsl:variable name="rtf">
<xsl:call-template name="FindMaxStringLength">
<xsl:with-param name="n" select="count(//tr/td)" />
</xsl:call-template>
</xsl:variable>
<colgroup>
<xsl:for-each select="$rtf/x">
<col width="{format-number(((. div (sum(../*))) * 100),
'##.##')}%"/>
</xsl:for-each>
</colgroup>
<xsl:copy-of select="*" />
</table>
</xsl:template>
<xsl:template name="FindMaxStringLength">
<xsl:param name="n" />
<xsl:if test="$n > 0">
<x>
<xsl:for-each select="/tr[2]/th[$n] | /tr/td[$n]">
<xsl:sort select="string-length(.)" order="descending" />
<xsl:if test="position() = 1">
<xsl:value-of select="string-length(.)" />
</xsl:if >
</xsl:for-each>
</x>
<xsl:call-template name="FindMaxStringLength">
<xsl:with-param name="n" select="$n - 1" />
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="tr">
<xsl:text>
</xsl:text><tr>
<xsl:apply-templates/>
</tr>
</xsl:template>
<xsl:template match="td">
<xsl:text>
</xsl:text><td>
<xsl:apply-templates/>
</td>
</xsl:template>
<xsl:template match="th">
<xsl:text>
</xsl:text><th>
<xsl:apply-templates/>
</th>
</xsl:template>
<xsl:template match="thead">
<xsl:text>
</xsl:text><thead>
<xsl:apply-templates/>
</thead>
</xsl:template>
<xsl:template match="tbody">
<xsl:text>
</xsl:text><tbody>
<xsl:apply-templates/>
</tbody>
</xsl:template>
</xsl:transform>
Now Output -->
-----------------
<?xml version="1.0" encoding="US-ASCII"?>
<document>
<title>FCC and IEEE Regulations</title>
<para>Table 1.3 shows the relative FCC and IEEE power output
limits.</para>
<table>
<table.html frame="void" width="100%" rules="groups" align="left"/>
<colgroup>
<col width="NaN%"/>
<col width="NaN%"/>
<col width="NaN%"/>
<col width="NaN%"/>
<col width="NaN%"/>
<col width="NaN%"/>
<col width="NaN%"/>
<col width="NaN%"/>
<col width="NaN%"/>
</colgroup>
<thead>
<tr>
<th valign="top" colspan="3">Table 1.3 802.11a Power Output
Limits</th>
</tr>
<tr>
<th valign="top">
<b>Spectrum Range</b>
</th>
<th valign="top">
<b>FCC Limit</b>
</th>
<th valign="top">
<b>IEEE Limit</b>
</th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top">5.15 GHz–5.25 GHz</td>
<td valign="top">5.15 GHz–5.25 GHz</td>
<td valign="top">40 mW</td>
</tr>
<tr>
<td valign="top">5.25 GHz–5.35 GHz</td>
<td valign="top">200 mW</td>
<td valign="top">250 mW</td>
</tr>
<tr>
<td valign="top">5.725 GHz–5.825 GHz</td>
<td valign="top">800 mW</td>
<td valign="top">1,000 mW</td>
</tr>
</tbody>
</table>
</document>
Not convert to percentage and maximu <col width="?">
Thanks,
Byomkesh
----- Original Message -----
From: "Mukul Gandhi" <gandhi(_dot_)mukul(_at_)gmail(_dot_)com>
To: "Byomkesh" <bkesh(_at_)eztechgroup(_dot_)net>
Cc: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Tuesday, June 27, 2006 1:13 PM
Subject: Re: [xsl] How count the Table cell (Cals Table) using XSL
Hi Byomkesh,
I am not getting the error you posted.
XML is (I had to correct a well formdness error):
<table border="0" cellspacing="0" cellpadding="1" width="90%">
<thead>
<tr>
<th valign="top" colspan="3"><b>Table 1.1 802.11b Channels</b></th>
</tr>
<tr>
<th>Channel Number</th>
<th>Center Frequency (in GHz)</th>
<th>USA</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2.412</td>
<td>✓</td>
</tr>
</tbody>
</table>
With the stylesheet I posted, I am getting output:
java net.sf.saxon.Transform bk.xml bk.xsl
<?xml version="1.0" encoding="UTF-8"?>
<table>
<table.html frame="void" width="100%" rules="groups" align="left"/>
<colgroup>
<col width="7.14%"/>
<col width="59.52%"/>
<col width="33.33%"/>
</colgroup>
<thead>
<tr>
<th valign="top" colspan="3">
<b>Table 1.1 802.11b Channels</b>
</th>
</tr>
<tr>
<th>Channel Number</th>
<th>Center Frequency (in GHz)</th>
<th>USA</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2.412</td>
<td>Γ£ô</td>
</tr>
</tbody>
</table>
I am using Saxon basic version. Are you using Saxon Schema Aware version?
Regards,
Mukul
On 6/27/06, Byomkesh <bkesh(_at_)eztechgroup(_dot_)net> wrote:
Hi Mukul,
Thanks for your help. But its showing validation Error
<!---
Validation error
FORG0001: Cannot convert string "" to a double
Transformation failed: Run-time errors were reported
-->
I have using Saxon 8.7.3j. I did not understand this error. Please Sorry
again i am disturb you.
Now what can i do?
Thanks
Byomkesh
----------------------------------------------------------------------------
----
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.5/376 - Release Date: 6/26/2006
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--