RE: [xsl] Difficulty with semi-recursive operation in XSLT

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


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: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: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}" />


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" />

to insert the fo:table-columns based on the tabs attribute of the current p

Since this seems to be the key problem you're trying to solve, I hope this

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.



 XSL-List info and archive:

Current Thread