xsl-list
[Top] [All Lists]

Re: [xsl] CALS to XHTML table - rowspan

2015-10-06 09:23:23
Hi,

It is quite interesting to see that CALS (OASIS) tables have finally
been "licked".

My version is at
https://github.com/wendellpiez/JATSPreviewStylesheets. I basically had
the same idea as Eliot from the sound of it.

In my implementation, the table normalization logic is encapsulated in
a module that can be called for either HTML or XSL-FO results. Also,
useful functionality is coded as functions, so the same code can be
integrated into Schematron, thus permitting some XPath-based
validation of the table (prior to processing) in a supporting
environment.

It is also interesting to note that even to this day, there are one or
two features of "old" CALS/OASIS tables that are not dependably
handled in rendering technologies, such as alignment of cell contents
on characters, or rotation ...

Cheers, Wendell


On Tue, Oct 6, 2015 at 9:38 AM, Kraetke, Martin, le-tex
martin(_dot_)kraetke(_at_)le-tex(_dot_)de 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>
wrote:
Hi,

here is another approach. We implemented Andrew Welchs table normalization
algorithm for CALS tables. This XSLT generates virtual cells for colspans
and rowspans.

https://github.com/transpect/xslt-util/blob/master/calstable/xsl/normalize.xsl

You can import the XSLT normalize.xsl and call the function
calstable:normalize(). Below is an example:


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xs="http://www.w3.org/2001/XMLSchema";
  xmlns:css="http://www.w3.org/1996/css";
  xmlns:hub="http://docbook.org/ns/docbook";
  xmlns:dbk="http://docbook.org/ns/docbook";
  xmlns:saxon="http://saxon.sf.net/";
  xmlns:tr="http://www.transpect.io";
  xmlns:calstable="http://docs.oasis-open.org/ns/oasis-exchange/table";
  version="2.0">

  <!-- Documentation: in normalize.xsl -->
  <xsl:import href="normalize.xsl"/>

  <xsl:output indent="yes"/>

  <xsl:template match="node() | @*" >
    <xsl:copy copy-namespaces="no">
      <xsl:apply-templates select="@*, node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="*[*:row]">
    <xsl:sequence select="calstable:check-normalized(
                            calstable:normalize(.),
                            'no'
                          )"/>
  </xsl:template>

</xsl:stylesheet>


kind regards,

Martin


Am 05.10.2015 um 17:40 schrieb a kusa akusa8(_at_)gmail(_dot_)com:

Hello:

It has been a while since I worked on XSLT. But I have a current issue
that I need to solve with xslt.

I have a CALS table that has @morerows. I have to generate a table
that does not have a rowspan attribute, and generate cells according
to the value of @morerows.

So, my input XML looks like this:

<table>
<tgroup>
<tbody>
<row><entry morerows="2">test 1</entry>
<entry morerows="1">test 2</entry>
<entry morerows="0">test 3</entry>
</row>
<row><entry morerows="0">test 4</entry>
<entry morerows="1">test 5</entry>
<entry morerows="0">test 6</entry>
</row>
</tbody>
</tgroup>
</table>

How do I generate rows/cells based on morerows in xslt?

Any tips is appreciated.






-- 
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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