<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Helvetica, Arial, sans-serif">I have several genbook
projects which I want to be able to export from OpenOffice Writer to
OSIS. I downloaded the TEI package from
<a class="moz-txt-link-freetext"
href="http://www.tei-c.org/wiki/index.php/TEI_OpenOffice_Package">http://www.tei-c.org/wiki/index.php/TEI_OpenOffice_Package</a>
and started
playing around (I know next to nothing about XSLT except what I could
glean from <a class="moz-txt-link-abbreviated" href="http://www.w3schools.com">www.w3schools.com</a>). <br>
<br>
With some modifications I was able to get a rather rough OSIS document,
at least with valid <div> and <p> elements nested properly.
I created a template for Writer that has custom text styles that
correspond to OSIS div types: bookGroup, book, chapter, section,
subSection. I added x-unit (between book and chapter) to correspond to
a unit of chapters. I arranged these in the template in the outline
numbering
according to the following order: <br>
<br>
</font><font face="Helvetica, Arial, sans-serif">1 bookGroup<br>
2 x-unit<br>
3 book<br>
4 chapter<br>
5 section<br>
6 subSection</font><br>
<font face="Helvetica, Arial, sans-serif"><br>
The XSLT arranges the parent-child relationships between <div>
elements based on the outline numbering order in Writer. The type
attribute is easy enough to add, but I am having trouble getting an
osisID (The text that is placed in the style "book," for example, which
creates the division). With the xslt as it is now, the chapter div
looks like this:<br>
<br>
</font><tt><div type="chapter" osisID="***"><br>
<title>Chapter 1</title><br>
</div><br>
<br>
</tt><font face="Helvetica, Arial, sans-serif">I would like it to look
like this:</font><br>
<tt><br>
<div type="chapter" osisID="</tt><tt>Chapter 1</tt><tt>"><br>
<title>Chapter 1</title><br>
</div></tt><font face="Helvetica, Arial, sans-serif"><tt><br>
</tt></font><tt></tt><font face="Helvetica, Arial, sans-serif"><br>
How do I retrieve that text to place it in osisID?<br>
<br>
This is the relevant template (line 371 in the xsl file):<br>
</font><tt> <xsl:template name="make-section"><br>
<xsl:param name="current"/><br>
<xsl:param name="prev"/><br>
<xsl:text
disable-output-escaping="yes">&lt;div</xsl:text><br>
<xsl:text> type=&quot;</xsl:text><br>
<xsl:value-of select="@text:style-name" /><br>
<xsl:text>&quot;</xsl:text><br>
<xsl:text> osisID=&quot;</xsl:text><br>
<xsl:value-of select="***" /><br>
<xsl:text>&quot;</xsl:text><br>
<xsl:call-template name="id.attribute.literal"/><br>
<xsl:text
disable-output-escaping="yes">&gt;</xsl:text><br>
<xsl:choose><br>
<xsl:when test="$current &gt; $prev+1"><br>
<title/><br>
<xsl:call-template name="make-section"><br>
<xsl:with-param name="current" select="$current"/><br>
<xsl:with-param name="prev" select="$prev+1"/><br>
</xsl:call-template><br>
</xsl:when><br>
<xsl:otherwise><br>
<title><br>
<xsl:apply-templates/><br>
</title><br>
<xsl:variable name="this"><br>
<xsl:value-of select="generate-id()"/><br>
</xsl:variable><br>
<xsl:for-each select="key('headchildren', $this)"><br>
<xsl:if test="not(parent::text:h)"><br>
<xsl:apply-templates select="."/><br>
</xsl:if><br>
</xsl:for-each><br>
<xsl:choose><br>
<xsl:when test="$current=1"><br>
<xsl:apply-templates select="key('children1',<br>
generate-id())"/><br>
</xsl:when><br>
<xsl:when test="$current=2"><br>
<xsl:apply-templates select="key('children2',<br>
generate-id())"/><br>
</xsl:when><br>
<xsl:when test="$current=3"><br>
<xsl:apply-templates select="key('children3',<br>
generate-id())"/><br>
</xsl:when><br>
<xsl:when test="$current=4"><br>
<xsl:apply-templates select="key('children4',<br>
generate-id())"/><br>
</xsl:when><br>
<xsl:when test="$current=5"><br>
<xsl:apply-templates select="key('children5',<br>
generate-id())"/><br>
</xsl:when><br>
<xsl:when test="$current=6"><br>
<xsl:apply-templates select="key('children6',<br>
generate-id())"/><br>
</xsl:when><br>
</xsl:choose><br>
</xsl:otherwise><br>
</xsl:choose><br>
</xsl:template></tt><font face="Helvetica, Arial, sans-serif"><br>
</font><tt></tt><br>
<font face="Helvetica, Arial, sans-serif">I attached the xsl file,
OpenOffice Writer template, and the exported xml. Sorry for such a
basic question, but I'm so new to xslt that I don't even know where to
look for an answer.<br>
</font><br>
<font face="Helvetica, Arial, sans-serif">Daniel</font><br>
-- <br>
PMBX license 1502 <br>
</body>
</html>