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

Re: xsl table

Subject: Re: xsl table
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 Jun 2007 18:54:51 +0300
Re:  xsl table
At 2007-06-13 09:38 +0200, Andreas Peter wrote:
And this is my xsl file:

<xsl:template match="table">
 <fo:block xsl:use-attribute-sets="kursinfo">
 <fo:table table-layout="{$table.layout}" width="{$table.width}">
 <fo:table-body>
 <xsl:apply-templates select="tr" />
 </fo:table-body>
 </fo:table>
 </fo:block>
</xsl:template>

<xsl:template match="tr">
 <xsl:param name="pos_tr" select="position()" />

The above line can be removed.


 <fo:table-row>
 <xsl:apply-templates select="td" />

Change the above to:


  <xsl:apply-templates select="td">
     <xsl:with-param name="pos_tr" select="position()"/>
  </xsl:apply-templates/>

 </fo:table-row>
</xsl:template>

<xsl:template match="td">

Add:


<xsl:param name="pos_t4"/>

<xsl:param name="pos_td" select="position()" />

That can be <xsl:variable/>


<fo:table-cell column-number="1" width="{$table.colwidth1}">

Is $table.colwidth1 a global?


<fo:block><xsl:value-of select="//tr[$pos_tr]/td[$pos_td]"/>

That seems strange to me ... not sure why you are selecting from the very top of the document ... and it would seem that just select="." would obtain the same construct. And if you have more than one table, the values will always be selected from the first table.


I've answered you how you can use variables, but I'm not sure why you are using variables.

 </fo:block></fo:table-cell>
</xsl:template>

I want to use a variable for the <tr>-position as well as for the
<td>-position.

Can you explain why you think this is necessary?


How can I manage it to use the variable from <tr> when
I match <td>? If I want to parse the document an error occurs saying
"variable with name pos_tr could not be founded..."

The scope of a variable is only the following siblings and their descendants. At the point where you made reference to $pos_tr there were no ancestors with a preceding sibling declaration of the variable. I've added that with the parameter.


I hope this helps.

. . . . . . . . . . . . . Ken

--
Upcoming hands-on training(Europe 2007): XSL-FO Jun 11; UBL Oct 01
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.