|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Difficulty with semi-recursive operation in XSLT
> -----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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






