AW: [xsl] Stylesheet for converting XHTML tables to CALS

Subject: AW: [xsl] Stylesheet for converting XHTML tables to CALS
From: "Huditsch, Roman \(LNG-VIE\)" <Roman.Huditsch@xxxxxxxxxxxxx>
Date: Mon, 6 Mar 2006 14:22:54 +0100
Hi David,

Thanks a lot for your comments.
It seems as there is still a lot orf work to be done for me :)

best regards,
Roman

> -----Urspr|ngliche Nachricht-----
> Von: David Carlisle [mailto:davidc@xxxxxxxxx]
> Gesendet: Montag, 06. Mdrz 2006 13:03
> An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff: Re: [xsl] Stylesheet for converting XHTML tables to CALS
>
>
> > I just finished my first attempt to transform XHTML tables
> into tables
> > conforming to the CALS table model.
> > Attached is my XSLT 2.0 stylesheet. Every feedback is
> heartily welcome
> > :)
>
> You appear to be generating elements in the xhtml namespace
> they should probably be in no-namespace or the new docbook 5
> namespace or something, seeing as <entry>  etc are not xhtml.
>
> <xsl:param name="border" select="if(starts-with(@border,
> '0')) then(xs:boolean(0)) else(xs:boolean(1))" as="xs:boolean"
> tunnel="yes"/>
>
> you are starting with a boolean value
> starts-with(@border,'0')
> then if it is true, taking an integer literal and coercing it
> to a boolean. If you need boolean values you can just use
> true() and false() but here you just need <xsl:param
> name="border" select="not(starts-with(@border,'0'))"/>
>
>
> <xsl:apply-templates
> select="xhtml:tr[not(parent::*[local-name()=('thead',
> 'tbody', 'tfoot')])] | xhtml:tbody/xhtml:tr"/>
>
> It's best not to use local-name() in such tests but just to
> use name tests (which are namespace aware) however in this
> case the current element is <table> so the parent of every
> element selected by xhtml:tr is table and so the filter
> testing on local-name is not doing anything.
> so it could be
>
> select="xhtml:tr| xhtml:tbody/xhtml:tr"/>
>
>
> In
>
>   <xsl:template match="xhtml:th | xhtml:td">
> 		<xsl:variable name="position"
>   select="count(preceding-sibling::*) + 1"/>
> 		<entry>
>   			<xsl:if test="@colspan &gt; 1">
> 				<xsl:attribute name="namest">
> 					<xsl:value-of
>   select="concat('col',$position)"/>
>
> don't you need to take account of any colspan attributes in
> earlier columns, and rowspan attributes in earlier rows in
> order to know which coulmn an entry in a table corresponds
> to? (This is the hardest part of switching between html and
> cals tables). In the above you are assuming that the second
> td entry in a row is corresponding to the second column, but
> this is not the case if the first entry spans columns, or if
> an entry in an earlier row spans into the first cell of this row.
>
> David
>
> ______________________________________________________________
> __________
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a
> proactive anti-virus service working around the clock, around
> the globe, visit:
> http://www.star.net.uk
> ______________________________________________________________
> __________

Current Thread