[sword-devel] XSLT for OpenOffice export to OSIS Genbook

Sebastien Koechlin seb.sword at koocotte.org
Thu Feb 14 00:32:40 MST 2008

On Wed, Feb 13, 2008 at 01:36:22PM +0700, Daniel Owens wrote:
> <font face="Helvetica, Arial, sans-serif">I made some modifications to
> the XSLT to make provision for Scripture references and to simplify how
> images are handled. The attached zip archive contains the filter,
> instructions, and a few other useful files related to the filter. I
> will update the instructions on the wiki once it is
> up and running again. For now, though, here is version 1.0 of the
> filter. Enjoy!<br>
> <br>
> Daniel<br>

This look great.

I did not find oowriter2osis.xsl in your last zip file, so I read the file
you posted on Feb 8.  You should avoid using 'disable-output-escaping' if
possible because:
- It makes you mix structure and content
- It can produce invalide XML
- The XML tree produced is not usable unless serialized
- You can open a tag in a template and close it in another

In <xsl:template name="header">, you have 
	<xsl:text disable-output-escaping="yes"><refSystem>Bible</refSystem></xsl:text>
, but
should do the same.

When looking for help about XSLT, I use
http://www.w3schools.com/xsl/xsl_w3celementref.asp and
http://www.w3schools.com/xpath/xpath_functions.asp is for XPath.

You should read the full XSLT tag list to see which exist.

For <xsl:template match="text:h">, you have

	<xsl:variable name="sectvar">
	<xsl:variable name="idvar">
		<xsl:text> type="x-</xsl:text>
		<xsl:value-of select="@text:style-name"/>
	<xsl:text disable-output-escaping="yes"><</xsl:text>
	<xsl:value-of select="$sectvar"/>
	<xsl:value-of select="$idvar"/>
	<xsl:text disable-output-escaping="yes">></xsl:text>
	<xsl:text disable-output-escaping="yes"></</xsl:text>
	<xsl:value-of select="$sectvar"/>
	<xsl:text disable-output-escaping="yes">></xsl:text>

But with <xsl:attribute> you can do the same (not tested):

	<xsl:variable name="idvar" select="@text:style-name"/>
		<xsl:attribute name="type">
			<xsl:text><xsl:value-of select="concat('x-',$idvar)"/></xsl:text>

Seb, autocuiseur

More information about the sword-devel mailing list