[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: fun with fo tab formatting - sorry, update!

Subject: RE: fun with fo tab formatting - sorry, update!
From: "Kyle Partridge" <kpartridge@xxxxxxxxxxxx>
Date: Thu, 11 Dec 2003 16:04:52 -0500
fo tab
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.