ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
RE: [xsl] fun with fo tab formatting - sorry, update!
by Kyle Partridge other posts by this author
Dec 11 2003 9:04PM messages near this date
Re: [xsl] Different templates for same set of nodes | RE: [xsl] fun with fo tab formatting
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved