|
Subject: RE: [xsl] Difficulty with semi-recursive operation in XSLT From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx> Date: Sat, 27 Dec 2003 13:49:29 +0100 |
> -----Original Message-----
> From: Kyle Partridge
Hi,
Still working out the details, but for a starter :
> <xsl:variable name="column-width">
> <!-- I want the $column-numberth item
> from the parent::p/@tabs, minus the ($column-number - 1)th item - how
> can I get that?? -->
> </xsl:variable>
In short: they are not items. The tabs attribute consists of one string that
needs to be broken up.
If we name parent::p/@tabs 't', you would get the value of the first 'item'
like :
number(substring-before($t,' '))
the second like:
number(substring-before(substring-after($t,' '),' '))
To perform a generic extraction like this, based on a given index, seems a
little awkward unless you were to create the columns recursively with a
named template like :
<xsl:template name="createcols">
<xsl:param name="tabs" />
<xsl:param name="inittab" />
<xsl:choose>
<xsl:when test="contains($tabs,' ')">
<xsl:variable name="colwidth" select="number(substring-before($tabs,'
'))-$inittab" />
<fo:table-column column-width="{$colwidth}" />
<xsl:call-template name="createcols">
<xsl:with-param name="tabs" select="substring-after($tabs,' ')" />
<xsl:with-param name="inittab"
select="number(substring-before($tabs,' '))" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="colwidth" select="number($tabs) - $inittab" />
<fo:table-column column-width="{$colwidth}" />
<xsl:variable name="lastcolwidth" select="7.5 - number($tabs)" />
<fo:table-column column-width="{$lastcolwidth}" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Then on the appropriate place, just call the template :
<xsl:call-template name="createcols">
<xsl:with-param name="tabs" select="@tabs" />
<xsl:with-param name="inittab" select="0" />
</xsl:call-template>
to insert the fo:table-columns based on the tabs attribute of the current p
element.
Since this seems to be the key problem you're trying to solve, I hope this
helps.
Also, my sources inform me that it's better to use an fo:wrapper instead of
an fo:inline for the italic and bold parts. Haven't yet figured out why
exactly, though. I guess it has sth to do with fo:inlines generating
reference areas of their own.
Cheers,
Andreas
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Difficulty with semi-recursiv, Kyle Partridge | Thread | [xsl] Format & display from two xml, Sindigi, Ganesh K |
| [xsl] Format & display from two xml, Sindigi, Ganesh K | Date | Re: list activity, owner-xsl-list |
| Month |