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

RE: Convert CALS Table

Subject: RE: Convert CALS Table
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Mon, 21 Feb 2005 16:02:46 -0000
java table model colspan rowspan
Have a look at:

http://www.dpawson.co.uk/xsl/sect2/N7450.html#d9331e730

cheers
andrew

> hallo,
>
> i've found a solution via manipulating xml in java. if someone is
> interested in the source - write me a mail.
>
> but i'm still interested in the question if this problem is
> solvable in
> xslt. i'm more interested in an idea, than in a complete working
> stylesheet.
>
> thanks
> gregor
>
>
> Am Fri, 18 Feb 2005 20:10:13 +0100 schrieb gregor FELLENZ
> <gf_public@xxxxxxx>:
>
> > hello xsl-list,
> >
> > i have to normalize CALS tables, to another table model
> which has no
> > colspan resp. rowspan abilities.
> >
> > I have to fill for each omitted entry an empty cell in my new
> > document, to generate valid tables.
> >
> > Realizing this for colspan is no problem (as you can see in my
> > xslt) but i have no idea how to cover the rowspan.
> > The problem is, that i have to insert in every spanned row an empty
> > cell, but how can i gather this information?
> >
> > Any ideas or hints how i can realize this?
> >
> > Thanks
> >
> > gregor
> >
> > *** MY XSLT
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet version="2.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > <xsl:output indent="yes" method="xml"/>
> > <xsl:template match="table">
> >         <tablex>
> >                 <xsl:apply-templates/>
> >         </tablex>
> > </xsl:template>
> >
> > <xsl:template match="row">
> >         <row>
> >                 <xsl:for-each select="entry">
> >                         <xsl:choose>
> >                                 <xsl:when test="@namest != '' ">
> >                                         <xsl:variable name="temp"
> > select="@nameend"/>
> >                                         <xsl:variable name="ende"
> > select="ancestor::*/colspec[@colname = $temp]/@colnum"/>
> >                                         <cell>
> >
> <xsl:apply-templates/>
> >                                         </cell>
> >                                         <xsl:call-template
> > name="zellenschreiben">
> >                                                 <xsl:with-param
> > name="anzahl" select="1"/>
> >                                                 <xsl:with-param
> > name="ende" select="$ende -position()"/>
> >                                         </xsl:call-template>
> >                                 </xsl:when>
> >                                 <xsl:otherwise>
> >                                         <cell>
> >
> <xsl:apply-templates/>
> >                                         </cell>
> >                                 </xsl:otherwise>
> >                         </xsl:choose>
> >                 </xsl:for-each>
> >         </row>
> > </xsl:template>
> >
> > <xsl:template name="zellenschreiben">
> >         <xsl:param name="anzahl"/>
> >         <xsl:param name="ende"/>
> >         <xsl:if test="$anzahl &lt;= $ende">
> >                 <cell/>
> >                 <xsl:call-template name="zellenschreiben">
> >                         <xsl:with-param name="anzahl"
> select="$anzahl
> > + 1"/>
> >                         <xsl:with-param name="ende" select="$ende"/>
> >                 </xsl:call-template>
> >         </xsl:if>
> > </xsl:template>
> > </xsl:stylesheet>
> >
> >
> > *** Source Example, its CALS
> > <table>
> >         <tgroup cols="4">
> >                 <colspec colnum="1" colname="spycolgen1"
> > colwidth="1.0*"/>
> >                 <colspec colnum="2" colname="spycolgen2"
> > colwidth="1.0*"/>
> >                 <colspec colnum="3" colname="spycolgen3"
> > colwidth="1.0*"/>
> >                 <colspec colnum="4" colname="spycolgen4"
> > colwidth="1.0*"/>
> >                 <tbody>
> >                         <row>
> >                                 <entry namest="spycolgen1"
> > nameend="spycolgen3">colspan</entry>
> >                                 <entry>2</entry>
> >                         </row>
> >                         <row>
> >                                 <entry morerows="1">rowspan</entry>
> >                                 <entry>4</entry>
> >                                 <entry>5</entry>
> >                                 <entry>6</entry>
> >                         </row>
> >                         <row>
> >                                 <entry>7</entry>
> >                                 <entry>8</entry>
> >                                 <entry>9</entry>
> >                         </row>
> >                 </tbody>
> >         </tgroup>
> > </table>
> >
> > *** Result ...
> > <tablex>
> >         <row>
> >                 <cell>colspan</cell>
> >                 <cell/><!-- This empty cell comes from the
> colspan ...
> > -->
> >                 <cell/>
> >                 <cell>2</cell>
> >         </row>
> >         <row>
> >                 <cell>rowspan</cell>
> >                 <cell>4</cell>
> >                 <cell>5</cell>
> >                 <cell>6</cell>
> >         </row>
> >         <row>
> >                 <!-- Here I need another <cell/> to get
> valid code -->
> >                 <cell>7</cell>
> >                 <cell>8</cell>
> >                 <cell>9</cell>
> >         </row>
> > </tablex>
> >
>
>
>
> --
> Erstellt mit Operas revolutiondrem E-Mail-Modul:
http://www.opera.com/m2/

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.