Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7879413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:53:45+00:00 2026-06-03T03:53:45+00:00

I am having an issue on trying to get the width for each td,

  • 0

I am having an issue on trying to get the width for each td, I am currently getting out a blank value inside my column-width, how do I get the value of each td.

 <xsl:template match="table">
    <fo:table table-layout="fixed">
    <xsl:call-template name="tokenize-style"/>
      <!-- Calculate the table cols... -->
      <xsl:for-each select="tbody/tr[1]/td">
        <fo:table-column>  
          <xsl:attribute name="column-width">
<xsl:value-of select="@width"></xsl:value-of>

          </xsl:attribute>
        </fo:table-column>
      </xsl:for-each>
      <xsl:apply-templates select="*|text()"/>
    </fo:table>
  </xsl:template>
  <xsl:template match="tbody">
    <fo:table-body>
      <xsl:apply-templates select="*|text()"/>
    </fo:table-body>
  </xsl:template>

Based on the HTML ->

<table class="te-tablerenderer" style="width: 170mm; text-align: left;">
            <tbody style="text-align: left;">
               <tr class="" style="text-align: left;">
                  <td style="width: 141px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-right-color: rgb(255, 255, 255); border-bottom-color: rgb(255, 255, 255); border-left-color: rgb(255, 255, 255); "> </td>
                  <td style="width: 143px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-right-color: rgb(255, 255, 255); border-bottom-color: rgb(255, 255, 255); border-left-color: rgb(255, 255, 255); ">          
                     <b>Postcode:</b>        
                  </td>       
                  <td class="GENTICS_Table_Cell_active"
                      style="width: 325px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-right-color: rgb(255, 255, 255); border-bottom-color: rgb(255, 255, 255); border-left-color: rgb(255, 255, 255); ">          
                     djnds fnjksdnf      
                  </td>        
                  <td style="width: 33px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-right-color: rgb(255, 255, 255); border-bottom-color: rgb(255, 255, 255); border-left-color: rgb(255, 255, 255); ">         </td>    
               </tr>
            </tbody>
         </table>

Note: This is the template I call when I want to get all my styles for an element:

  <xsl:template name="tokenize-style">
    <xsl:param name="pString" select="string(@style)"/>
    <xsl:choose>
      <xsl:when test="not($pString)"/>
      <xsl:when test="contains($pString,';')">
        <xsl:call-template name="tokenize-style">
          <xsl:with-param name="pString"
               select="substring-before($pString,';')"/>
        </xsl:call-template>
        <xsl:call-template name="tokenize-style">
          <xsl:with-param name="pString"
               select="substring-after($pString,';')"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:attribute name="{normalize-space(substring-before($pString,':'))}">
          <xsl:value-of select="normalize-space(substring-after($pString,':'))"/>
        </xsl:attribute>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

Output

<fo:table table-layout="fixed" width="170mm" text-align="left">
                  <fo:table-column column-width=""/>
                  <fo:table-column column-width=""/>
                  <fo:table-column column-width=""/>
                  <fo:table-column column-width=""/>
                  <fo:table-body>
                     <fo:table-row>
                        <fo:table-cell padding-start="1pt" padding-end="1pt" padding-before="1pt" padding-after="1pt"
                                       padding-top="1pt"
                                       padding-bottom="1pt">
                           <fo:block> </fo:block>
                        </fo:table-cell>

(..etc)

Note the column-width is blank…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:53:46+00:00Added an answer on June 3, 2026 at 3:53 am

    The problem is that the tds do not have a width attribute – you should call your tokenize-style template on each td and then get the width from its output, or extract directly the width from the style attribute – something like this:

      <xsl:attribute name="column-width"> 
         <xsl:value-of select="normalize-space(substring-before(substring-after(@syle,'width:'),';'))" /> 
      </xsl:attribute> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The issue I'm having is issue with is I'm trying to get the paintComponent
I'm having an issue here, I am trying to get all the titles from
I'm having an issue trying to get an accurate running total for my calculations.
i am having a issue with treeview liststore trying to get a real-time update,
We're having an issue trying to chain selectors together. We are trying to get
I'm having an issue when trying to run my project each time it builds.
I'm just trying to get started with NDjango but am having issues running a
I'm trying to get started with twitter4r but I'm having some issues: Why I
I am having an issue trying to make a small text-fantasy type game involving
I am having an issue trying to deal with timezones in the JQuery date/time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.