Subject: Re: [xsl] xsl table From: Florent Georges <darkman_spam@xxxxxxxx> Date: Wed, 13 Jun 2007 14:08:41 +0200 (CEST) |
Andreas Peter wrote: Hi > <xsl:template match="tr"> > <xsl:param name="pos_tr" select="position()" /> > <fo:table-row> > <xsl:apply-templates select="td" /> > </fo:table-row> > </xsl:template> > <xsl:template match="td"> > <xsl:param name="pos_td" select="position()" /> > <fo:table-cell column-number="1" width="{$table.colwidth1}"> > <fo:block><xsl:value-of select="//tr[$pos_tr]/td[$pos_td]"/> > </fo:block></fo:table-cell> > </xsl:template> > I want to use a variable for the <tr>-position as well as for the > <td>-position. 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..." Variables are lexicaly scoped. If you want to use a variable in one template from its caller, pass it with a parameter: <xsl:template match="tr"> <fo:table-row> <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"> <xsl:param name="pos_tr"/> <xsl:param name="pos_td" select="position()"/> <fo:table-cell column-number="1" width="{$table.colwidth1}"> <fo:block> <xsl:value-of select="//tr[$pos_tr]/td[$pos_td]"/> </fo:block> </fo:table-cell> </xsl:template> Note you maybe want a variable instead of a parameter for $pos_td. Regards, --drkm _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl table, Andreas Peter | Thread | Re: [xsl] xsl table, G. Ken Holman |
Re: [xsl] Todays technical challeng, Matt | Date | [xsl] Merging multiple documents an, Mark Peters |
Month |