RE: [xsl] fun with fo tab formatting

Subject: RE: [xsl] fun with fo tab formatting
From: "Kyle Partridge" <kpartridge@xxxxxxxxxxxx>
Date: Mon, 15 Dec 2003 15:22:34 -0500
Don't mean to be a pest, but can anyone help with this??  I can't seem
to get this working...  

Thanks.

-----Original Message-----
From: Kyle Partridge 
Sent: Thursday, December 11, 2003 4:05 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] fun with fo tab formatting - sorry, update!


Last one was old version...here's the real thing...sorry!!!


Hi List Members,

Eliot and Ken - thanks for pointing me in the right direction...  This
is as far as I have gotten:

	<xsl:template match="ws:tab">
		<xsl:if test="position()=1">
			<fo:table>
				<fo:table-body>
					<fo:table-row>
		</xsl:if>
				
		<xsl:element name="fo:table-cell">
			<xsl:attribute name="width">
				<xsl:call-template name="compute-width">
					<xsl:with-param name="list">
						<xsl:choose>
							<xsl:when
test="../@tabs">
	
<xsl:value-of select="../@tabs"/>
							</xsl:when>
							<xsl:otherwise>
	
<xsl:variable name="styleName" select="../@style"/>
	
<xsl:value-of
select="//ws:textStyle[@name=$styleName]/ws:blockAttr/@tabs"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:with-param>
					<xsl:with-param name="curpos">
						<xsl:choose>
							<xsl:when
test="preceding-sibling::ws:br">
	
<xsl:value-of select="count(../ws:tab)-position()"/>
							</xsl:when>
							<xsl:otherwise>
	
<xsl:value-of select="position()"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:with-param>
				</xsl:call-template>
			</xsl:attribute>
		</xsl:element>
		<fo:block/>
		<xsl:element name="fo:table-cell">
			<xsl:apply-templates/>
		</xsl:element>
				
		<xsl:if test="position()=../ws:tab[last()]">
					</fo:table-row>
				</fo:table-body>
			</fo:table>
		</xsl:if>		
	</xsl:template>

First, it won't let me save this, because it doesn't like me opening
tags in one statement and closing them in another...any way I can get
around this?

Second...I've reached a wall with my new "get-width" template:

<xsl:template name="get-width">
	<xsl:param name="list"/>
	<xsl:param name="curpos"/>
	<xsl:variable name="nlist"
select="concat(normalize-space($list), ' ')"/>
	<xsl:variable name="first" select="substring-before($nlist, '
')"/>
	<xsl:choose>
		<xsl:when test="$curpos=1">
			<xsl:value-of select="$first"/>
		</xsl:when>
		<xsl:otherwise>
			<!--want list[curpos] - list[curpos-1]...I
think.  But how???-->
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

If the curpos(tab) is 1, then I can just output the first string.
However, I can't come up with an algorithm that works for the rest of
the items.  If curpos is 2 or 3, or 4 or whatever, I want the tab width
output to be list[curpos] - list[curpos-1] but I don't know how to
express that here.  It's driving me batty!

Thanks for all your help/advice with this stuff - in case you couldn't
already tell, I find this very!! confusing.

KP




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread