Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 11th, 2008, 04:41 PM
Authorized User
 
Join Date: Jul 2008
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Table: width setting for a cell

Hi ,
 i am trying the set the width for a particular cell
consider the table (only a small piece given here, mine actual is with some more columns and rows)

+---------------------------------+
! aaa !bbb !ccc ! ddd !
!-----+------------+----+---------!
! 1 !Sample_data1!123-! data1234!
! ! !456-! data4569!
! ! !789 ! data8901!
!---------------------------------!

in the above table which i displayed using XSLT in Internet Explorer.
i need the width of cell under "ccc" to be expanded so that data under that same column will be adjusted to same width...am i right here?
so the the data 123-456-789 is displayed in a single line.

I used the follwoing XSLT code
<xsl:template name="Symbols">
               <tr bgcolor="#C0C0C0">
             <xsl:for-each select ="./Symbols/Name">
                  <xsl:variable name="temp" select="text()"/>
                   <xsl:choose>
                      <xsl:when test='$temp="ccc"'>
                        <td width="200" align="left"><b> <xsl:value-of select="."/></b></td>
                      </xsl:when>
                      <xsl:otherwise>
                         <td align="left" bgcolor="00ff00"><b><xsl:value-of select="."/></b></td>
                      </xsl:otherwise>
                   </xsl:choose>
             </xsl:for-each>
       </tr>
</xsl:template>

the above code works if the header(first row) alone present , but again the "ccc" cell gets compressed when i add further rows under that...
How can i get the cell expanded to the given given width for the entire "ccc" column?
can anyone help with it?

Note:
copy and paste the above table in the notepad for proper display.



Venki
__________________
Venki
 
Old July 11th, 2008, 05:28 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You haven't given any clues about what the source document looks like.

I'm a bit confused anyway. Surely you don't have to specify width on every td in a column of a table for the browser to render the column with a constant width?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 14th, 2008, 09:05 AM
Authorized User
 
Join Date: Jul 2008
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mhkay
 You haven't given any clues about what the source document looks like.

I'm a bit confused anyway. Surely you don't have to specify width on every td in a column of a table for the browser to render the column with a constant width?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
My sample source file is given here.As i said before the sample i given here is only the part, my actual file contains more number of rows and columns (i.e. in actual source file more number of Instance and DataSet Tabs will appear, for every Instance Tabs new row is introduced)

sample source code:

<Root>
    <Symbols>
      <Name Width="1">aaa</Name>
      <Name Width="1.5">bbb</Name>
      <Name Width="1">ccc</Name>
      <Name Width="1">ddd</Name>

    </Symbols>
    <Instance>
      <DataSet>
        <Data>1</Data>
      </DataSet>
      <DataSet>
        <Data>sample_data1</Data>
      </DataSet>
      <DataSet>
        <Data>123-456-789</Data>
      </DataSet>
      <DataSet>
        <Data>data1234data4569data8901</Data>
      </DataSet>
     </Instance>
</Root>

how can i make my cell in a same column to display constant specified width ?

Venki





Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting background image for gridvew cell anup_daware .NET Framework 2.0 0 September 17th, 2007 05:18 AM
Setting the Logical Page Width mitchm Crystal Reports 0 May 24th, 2007 06:03 PM
How to force table cell to a certain width? TheMajor HTML Code Clinic 1 April 17th, 2007 01:57 PM
Setting Column width in Datagrid anita General .NET 2 April 13th, 2005 02:25 AM
Setting Column Width r_ganesh76 Excel VBA 2 February 2nd, 2005 06:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.