[xsl] problem with table border

Subject: [xsl] problem with table border
From: Eldho George <georgee@xxxxxxxxxxx>
Date: Fri, 1 Oct 2004 17:35:34 +0530
Hi 
I am working with a project of converting a web page
into PDF.It works fine.I have some problem with table border.The following
is my xhtml file.

<table width="774" border="0" cellspacing="0" cellpadding="0" align="left">
	<tr>
		<td width="100%" valign="top">
			<table width="98%" border="0" align="center"
cellpadding="0" cellspacing="0">
				<tr>
					<td class="global-mainbody"
width="65%" valign="top"><br />
						<h2 class="standard"
style="text-align: center">
							DisclosuresIndex
						</h2>

						<table width="70%"
border="1" align="center" cellpadding="0">
							<tr>
								<td
align="center">
	
<b>Code</b>
								</td>
								<td
align="center">
	
<b>Description</b>
								</td>
							</tr>

							<tr>
								<td
align="center">
	
Title
								</td>
								<td
align="left" style="padding-left: 8px;">
									<a
href="#Title">UnderReview</a>
								</td>
							</tr>

						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
===========================================================
The following is my xsl-fo
===========================================================
<xsl:template name="tablechildborder">
	<xsl:choose>
		<xsl:when test="ancestor::table/@border">
			<xsl:variable name="tborder">
				<xsl:call-template name="retrievenumber">
					<xsl:with-param name="taborder"
select="ancestor::table/@border"/>
				</xsl:call-template>
			</xsl:variable>
			<xsl:if test="number($tborder) &gt; 0">

				<xsl:attribute
name="border-style">solid</xsl:attribute>
				<xsl:attribute
name="border-separation">1pt</xsl:attribute>			
				<xsl:attribute
name="border-width">thin</xsl:attribute>				
			</xsl:if>
		</xsl:when>						
	</xsl:choose>	
</xsl:template>
============================================================
<xsl:template match="tr">
    <fo:table-row keep-with-next="always">
		------------------------
		<xsl:apply-templates select="*|text()"/>
    </fo:table-row>
</xsl:template>
=============================================================
<xsl:template match="th">
    <fo:table-cell hyphenate="true">
	<xsl:call-template name="tablechildborder"/>
		<fo:block font-weight="bold" line-height="10pt"
keep-together="always" 
			space-before.optimum="1.5pt"
space-after.optimum="1.5pt" hyphenate="true">
		
       				 <xsl:apply-templates select="*|text()"/>
     		</fo:block>
    </fo:table-cell>
</xsl:template>
==============================================================
<xsl:template match="td">
    <fo:table-cell hyphenate="true">
	<xsl:call-template name="tablechildborder"/>
		<fo:block font-weight="bold" line-height="10pt"
keep-together="always" 
			space-before.optimum="1.5pt"
space-after.optimum="1.5pt" hyphenate="true">
		
       				 <xsl:apply-templates select="*|text()"/>
     		</fo:block>
    </fo:table-cell>
</xsl:template>
==============================================================
<xsl:attribute-set name="table-structure">
	<xsl:attribute name="table-layout">fixed</xsl:attribute>
	<xsl:attribute name="space-before">0pt</xsl:attribute>
	<xsl:attribute name="space-after">0pt</xsl:attribute>	
</xsl:attribute-set>

<xsl:template match="table">	
	<fo:table xsl:use-attribute-sets="table-structure">
		<xsl:call-template name="tableborder"/>//I have created this
template also
		<xsl:for-each select="tr|thead/tr|tbody/tr">
			<xsl:sort select="count(td|th)" data-type="number"
order="descending"/>
				<xsl:if test="position()=1">
					<xsl:for-each select="td|th">
						<fo:table-column/>
					</xsl:for-each>
				</xsl:if>
		</xsl:for-each>
	</fo:table>
</xsl:template>
=================================================================
Actually my problem is in the output, it won't show border for table-cell of
third table.Here it shows the table border only.
Suppose i am using border="1" in first table ,then it will work properly and
showing all border.It cannot process the
border of th/td of inner table.In "tablechildborder" template i tried with 

<xsl:when test="ancestor::table/@border">-------------
<xsl:when test="descendant::table/@border">-------------Both of them have
same effect.
It does not work.Suppose i specify the border in outer table(otherwise put
the third table alone),it will show all the border.
I think there is the problem with
<xsl:when test="ancestor::table/@border"> in tablechildborder template.

MY PURPOSE IS WHENEVR A TABLE CONTAIN border attribute > 1 i want to show
the border of th/td (like table display in InternetExplorer)

Please help me..
Thanks in advance
George
	


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

Current Thread