<!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 &lt;div&gt; and &lt;p&gt; 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 &lt;div&gt;
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>&lt;div type="chapter" osisID="***"&gt;<br>
&lt;title&gt;Chapter 1&lt;/title&gt;<br>
&lt;/div&gt;<br>
<br>
</tt><font face="Helvetica, Arial, sans-serif">I would like it to look
like this:</font><br>
<tt><br>
&lt;div type="chapter" osisID="</tt><tt>Chapter 1</tt><tt>"&gt;<br>
&lt;title&gt;Chapter 1&lt;/title&gt;<br>
&lt;/div&gt;</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>  &lt;xsl:template name="make-section"&gt;<br>
    &lt;xsl:param name="current"/&gt;<br>
    &lt;xsl:param name="prev"/&gt;<br>
    &lt;xsl:text
disable-output-escaping="yes"&gt;&amp;lt;div&lt;/xsl:text&gt;<br>
    &lt;xsl:text&gt; type=&amp;quot;&lt;/xsl:text&gt;<br>
    &lt;xsl:value-of select="@text:style-name" /&gt;<br>
    &lt;xsl:text&gt;&amp;quot;&lt;/xsl:text&gt;<br>
    &lt;xsl:text&gt; osisID=&amp;quot;&lt;/xsl:text&gt;<br>
    &lt;xsl:value-of select="***" /&gt;<br>
    &lt;xsl:text&gt;&amp;quot;&lt;/xsl:text&gt;<br>
    &lt;xsl:call-template name="id.attribute.literal"/&gt;<br>
    &lt;xsl:text
disable-output-escaping="yes"&gt;&amp;gt;&lt;/xsl:text&gt;<br>
    &lt;xsl:choose&gt;<br>
      &lt;xsl:when test="$current &amp;gt; $prev+1"&gt;<br>
        &lt;title/&gt;<br>
        &lt;xsl:call-template name="make-section"&gt;<br>
          &lt;xsl:with-param name="current" select="$current"/&gt;<br>
          &lt;xsl:with-param name="prev" select="$prev+1"/&gt;<br>
        &lt;/xsl:call-template&gt;<br>
      &lt;/xsl:when&gt;<br>
      &lt;xsl:otherwise&gt;<br>
        &lt;title&gt;<br>
          &lt;xsl:apply-templates/&gt;<br>
        &lt;/title&gt;<br>
        &lt;xsl:variable name="this"&gt;<br>
          &lt;xsl:value-of select="generate-id()"/&gt;<br>
        &lt;/xsl:variable&gt;<br>
        &lt;xsl:for-each select="key('headchildren', $this)"&gt;<br>
          &lt;xsl:if test="not(parent::text:h)"&gt;<br>
            &lt;xsl:apply-templates select="."/&gt;<br>
          &lt;/xsl:if&gt;<br>
        &lt;/xsl:for-each&gt;<br>
    &lt;xsl:choose&gt;<br>
      &lt;xsl:when test="$current=1"&gt;<br>
        &lt;xsl:apply-templates select="key('children1',<br>
                     generate-id())"/&gt;<br>
      &lt;/xsl:when&gt;<br>
      &lt;xsl:when test="$current=2"&gt;<br>
        &lt;xsl:apply-templates select="key('children2',<br>
                     generate-id())"/&gt;<br>
      &lt;/xsl:when&gt;<br>
      &lt;xsl:when test="$current=3"&gt;<br>
        &lt;xsl:apply-templates select="key('children3',<br>
                     generate-id())"/&gt;<br>
      &lt;/xsl:when&gt;<br>
      &lt;xsl:when test="$current=4"&gt;<br>
        &lt;xsl:apply-templates select="key('children4',<br>
                     generate-id())"/&gt;<br>
      &lt;/xsl:when&gt;<br>
      &lt;xsl:when test="$current=5"&gt;<br>
        &lt;xsl:apply-templates select="key('children5',<br>
                     generate-id())"/&gt;<br>
      &lt;/xsl:when&gt;<br>
      &lt;xsl:when test="$current=6"&gt;<br>
        &lt;xsl:apply-templates select="key('children6',<br>
                     generate-id())"/&gt;<br>
      &lt;/xsl:when&gt;<br>
    &lt;/xsl:choose&gt;<br>
      &lt;/xsl:otherwise&gt;<br>
    &lt;/xsl:choose&gt;<br>
  &lt;/xsl:template&gt;</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>