[xsl] Pulling xml attributes

Subject: [xsl] Pulling xml attributes
From: Luke Jones <ljones@xxxxxxxxxx>
Date: Thu, 28 Jun 2007 12:06:15 -0500
XSL Experts,

I have an xml document that contains the tags and attributes I need to
create a table in a pdf document.  I'm using FOP to do this.  The xml
document looks like:

<table>
<tgroup>
<colspec colname="col1" colwidth="2.09" /><colspec align="right"
colname="col2" colwidth="0.82" /><colspec align="right" colname="col3"
colwidth="0.73" /><colspec align="right" colname="col4"
colwidth="0.72" /><colspec align="right" colname="col5"
colwidth="0.67" />
<tbody>
<row>
<entry colsep="0" rowsep="0" />
<entry colsep="0" rowsep="0" />
<entry colsep="0" rowsep="0" />
<entry align="center" colsep="0" rowsep="0">Additional</entry>
<entry colsep="0" rowsep="0" />
</row>
<row>
....
</row
</tbody>
</tgroup>
</table>

I have template that tries to use all of this information to build the
table, and it looks like:

<xsl:template match = "table">
 <xsl:for-each select = "tgroup">
  <xsl:for-each select = "tbody/row">
   <fo:table table-layout = "fixed" width = "100%">
    <xsl:for-each select = "colspec">
     <fo:table-column column-width="{@colwidth}in"/>
    </xsl:for-each>
    <fo:table-body>
     <fo:table-row>
      <xsl:for-each select = "entry">
       <fo:table-cell>
        <fo:block line-height = "16pt" text-decoration="underline"
font-size="10pt">
         <xsl:value-of select = "." />
        </fo:block>
       </fo:table-cell>
      </xsl:for-each>
     </fo:table-row>
    </fo:table-body>
   </fo:table>
  </xsl:for-each>
 </xsl:for-each>
</xsl:template>

However -- it does not appear that the column-width = "{@colwidth}in" is
being recognized, because the size specifications are not being put in
there.  Rather it defaults to a proportional size for all the columns.

Does anyone see where the problem might be occurring?

Thanks!
Luke

Current Thread