cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Change Bars on Table Row

juliette.gibb1
1-Newbie

Change Bars on Table Row

Hello Adepters,

Does anyone know how to get a change bar to display against a row using
XSL? I have tried every logical and illogical thing I can think of but
it just isn't playing ball.

The <xsl:if test="child::para/@change"> works for paragraphs and I
thought of putting something like this on the entry element to call out
the parent row and put the change marker against the entire row. What I
do get with this option is a change markers against the two columns in
my table rather than just one in the margin for both columns.

<xsl:if test="parent::row/@change='add">

<xsl:attribute name="margin-right">-6mm</xsl:attribute>

<xsl:attribute name="border-right">solid red 2px</xsl:attribute>

</xsl:if>

This is an example of the XML:

<table tabstyle="Borders" id="T003">
<title>border2col</title>
<tgroup cols="2">
<colspec colname="1" colwidth="3*"/>
<colspec colname="2" colwidth="3*"/>
<thead>
<row>
<entry>...</entry>
<entry>... </entry>
</row>
</thead>
<tbody>
<row level="1" change="add">
<entry colname="1" namest="1" nameend="1">HSE Risk Management</entry>
<entry colname="2" namest="2" nameend="2">... </entry>
</row>
</tbody>
</tgroup>
</table>

This is an extract of the relevant XSL:

<xsl:template match="table">
<xsl:apply-templates select="tgroup"/">
</xsl:template>

<xsl:template match="tgroup">
<fo:table>
<fo:table-body>
<xsl:apply-templates select="tbody/row"/">
</fo:table-body>
</fo:table>
</fo:block>
</xsl:template>

<xsl:template match="row">
<fo:block margin-right="0pt">
<fo:table-row>
<xsl:apply-templates select="entry"/">
</fo:table-row>
</fo:block>
</xsl:template>

<xsl:template match="entry">
<fo:table-cell<br/>number-columns-spanned="{count(ancestor::table[1]/*/colspec[@colname=cur
rent()/@nameend]/preceding-sibling::colspec )
-count(ancestor::table[1]/*/colspec[@colname=current()/@namest]/precedin
g-sibling::colspec)+ 1 }" font-weight="normal" padding-top="4pt"
padding-bottom="4pt" padding-left="4pt" padding-right="4pt">
<fo:block font-family="arial" font-size="10pt" text-align="left"&lt;br"/>vertical-align="top" font-weight="normal" margin-right="0pt">
<xsl:if test="child::para/@change">
<xsl:attribute name="margin-right">-6mm</xsl:attribute>
<xsl:attribute name="border-right">solid white 2px</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>

Any suggestions would be greatly appreciated!

Thank you.

Kind Regards,
Juliette Gibb
Technical Publisher
Airline Publications
Safety Systems Division
Virgin Blue Airlines
3 REPLIES 3

Juliette,
First, the two caveats: YMMV, and I do XSLTs regularly, but have never used XSL-FO in Arbortext.

That said (bear with me here), your code looks the way I would expect, if you wanted the margin and border applied to the cell (entry). The test for @change is in the same place I would put it for that to happen in HTML in a browser. In HTML, applying it to the row doesn't produce the desired result because of the browser's paradigm, but Editor/PE does respond to FOSI calls within the row by placing a bar where you want it, so...

If you apply the test at the row, checking for descendant @change instances (and including your test for an 'add'ed row), you may get what you want. Something like:

<xsl:template match="row">
<xsl:choose>
<xsl:when test="descendant::*/@change" or=" @change="add" &quot;=">
<fo:block margin-right="-6mm">
<fo:block border-right="solid" white=" 2px&quot;=">
</xsl:when>
<xsl:otherwise>
<fo:block margin-right="0pt">
</xsl:otherwise>
</xsl:choose>
<fo:table-row>
<xsl:apply-templates select="entry"/">
</fo:table-row>
</fo:block>
</xsl:template>

BTW, your example XML doesn't have any para/@change instances, so it wouldn't produce a change mark with your current code, anyway. But you probably already knew that. 🙂

Hope that helps,
Steve Thompson
TAD Technical
Boeing-IDS Technical Publications
(316)977-0515
MC K83-08
The truth is the truth even if nobody believes it, and a lie is a lie even if everyone believes it.

NOTICE: This communication may contain proprietary or other confidential information. If you are not the intended recipient, or believe that you have received this communication in error, please do not print, copy, retransmit, disseminate, or otherwise use the information. Also, please indicate to the sender that you have received this e-mail in error, and delete the copy you received. Any and all views expressed are the current understanding of the sender and should not be interpreted as an expression of official Boeing Company policy or position.

Les renseignements contenus dans ce message peuvent être confidentiels. Si vous n'êtes pas le destinataire visé ou une personne autorisée à lui remettre ce courriel, vous êtes par la présente avisé qu'il est strictement interdit d'utiliser, de copier ou de distribuer ce courriel, de dévoiler la teneur de ce message ou de prendre quelque mesure fondée sur l'information contenue. Vous êtes donc prié d'aviser immédiatement l'expéditeur de cette erreur et de détruire ce message sans garder de copie.


To quote Pogo (old cartoon character) "ROWHR-BAZ!!"

Coding in an IDE can make you careless when doing it in a text editor (like this e-mail client). Here's a much better version (with actual thought involved) of my 'maybe this will work'. It uses your 'border-right' from the para, even though I don't understand why it would be 'white'.
<xsl:template match="row">
<fo:block>
<xsl:choose>
<xsl:when test="descendant::*/@change" or=" @change="add" &quot;=">
<xsl:attribute name="margin-right">-6mm</xsl:attribute>
<xsl:attribute name="border-right">solid white 2px</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="margin-right">0pt</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<fo:table-row>
<xsl:apply-templates select="entry"/">
</fo:table-row>
</fo:block>
</xsl:template>



Steve Thompson
(316)977-0515
When the only tool you have is a hammer,
Everything looks like a hard disk...

To get change bars in XSL-FO, use fo:change-bar-begin and
fo:change-bar-end. See
docs/ati_xsl_support/ati_xsl.htm in the Arbortext distribution. (Or, if
you are using a pre-5.2 versi...

Announcements