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

RE: fun with fo tab formatting

Subject: RE: fun with fo tab formatting
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Mon, 15 Dec 2003 23:48:57 +0100
xsl tab
> -----Original Message-----
> From: Kyle Partridge
>
> Don't mean to be a pest, but can anyone help with this??  I can't seem
> to get this working...
>
<snip />
>
> First, it won't let me save this, because it doesn't like me opening
> tags in one statement and closing them in another...

That seems --desirable, in most cases. Meaning: basically, if you run into
situations like this, where you're starting and ending elements in different
nodes, that's almost a guarantee there is _something_ icky about the
design...

> <xsl:template match="ws:tab">
>   <xsl:if test="position()=1">
>	<fo:table>
>	  <fo:table-body>
>	    <fo:table-row>
>   </xsl:if>

No, no, no... gathering from your original post, what you want is something
like :

<xsl:template match="ws:p">

  <fo:table layout="fixed" width="100%">
    <!-- columns... -->
    <!-- practical way to do it in this case, would be to match    -->
    <!-- the first br and create a column for every preceding tab  -->
    <!-- use a moded template for clarity                          -->
    <xsl:apply-templates select="br[1]" mode="colcreate" />

    <fo:table-body>
      <xsl:apply-templates select="br" mode="rowcreate" />
    </fo:table-body>
  </fo:table>

</xsl:template>

<xsl:template match="br" mode="colcreate">

  <xsl:variable name="cols" select="count(preceding-sibling::tab)" />
  <xsl:for-each select="preceding-sibling::tab">
    <fo:table-column column-width="proportional-column-width({$cols})" />
  </xsl:for-each>

</xsl:template>

<xsl:template match="br" mode="rowcreate">

  <xsl:variable name="cols" select="count(preceding-sibling::tab)" />

  <fo:table-row>
    <xsl:for-each select="preceding-sibling::tab[position() &lt;= $cols]">
      <fo:table-cell>
        <xsl:value-of select="following-sibling::text()[1]" />
      </fo:table-cell>
    </xsl:for-each>
  </fo:table-row>

</xsl:template>

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

If I guess correctly, you won't be needing this...?


Hope this helps!

Cheers,

Andreas


 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.