[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Pulling xml attributes

Subject: Re: Pulling xml attributes
From: "Manfred Staudinger" <manfred.staudinger@xxxxxxxxx>
Date: Thu, 28 Jun 2007 21:24:06 +0200
Re:  Pulling xml attributes
Hi Luke,

<xsl:for-each select = "tbody/row">
You are selecting row here but in the xml you showed,
row has no child element named "colspec"  so

<xsl:for-each select = "colspec">
does not select anything and therefor you will be missing
the table-column element in your output.

Hope this helps, Manfred


On 28/06/07, Luke Jones <ljones@xxxxxxxxxx> wrote:
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.