xsl-list
[Top] [All Lists]

pagebreak between elements

2003-08-20 16:50:51
Hi , I am currently writing some html coversion xsl sheets for a TEI based
dialect
the layout should basicly look like this


<table>
    <tr>
        <td>
            page1 text
        </td>
        <td>
            footnotes page 1
        </td>
    </tr>
    <tr>
        <td>
            page 2 text
        </td>
        <td>
            footnotes page 2
        </td>
    </tr>
</table>


the problem is that TEI uses  <pb /> (pagebreak) elements to seperate pages
instead of heving something like

<page>
    yadayada
</page>

this brings a problem

linebreaks can occur in lists , blockquotes etc

this means i close the tr tag on the pb element when a blockquote witch is
matched by another template is
still open, resulting in faulty html like this :

      <tr>
        <blockquote>
          part1
          </tr>
          part2
        </blockquote>
        <tr>

while i need this :

      <tr>
        <blockquote>
        part 1
        </blockquote>
      </tr>
      <tr>
        <blockquote>
        part 2
        </blockquote>
      </tr>

the way this is solved right now is that we check for the ancestor and then
close it
with

<xsl:when test="ancestor::blockquote">
  <xsl:text disable-output-escaping="yes"><![CDATA[
</blockquote>]]></xsl:text>
</xsl:when>

then close the tr, open another tr and then reopen the tag like this

<xsl:when test="ancestor::blockquote">
  <xsl:text disable-output-escaping="yes"><![CDATA[
<blockquote>]]></xsl:text>
</xsl:when>


IMHO Is is a quite distastefull solution as it increases the chances of
nonvalid output, and you basicly have 3 blockquote templates

if for instance i where to change

<xsl:template match="bq">
    <blockquote>
        <xsl:apply-templates />
    </blockquote>
</xsl:template>

to

<xsl:template match="bq">
    <div class="bq">
        <xsl:apply-templates />
    </div>
</xsl:template>

i'd also have to change the pb template on 2 locations


I imagine this is a fairly common problem and I find it hard to believe that
this would be the best solution available
but looking on the web I couldn't turn up anything
Can anyone offer a cleaner solution ? or is this really the way it should be
done

thanks in advance

-- jelmer


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



<Prev in Thread] Current Thread [Next in Thread>