<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Helvetica, Arial, sans-serif">Greg,<br>
<br>
I am not familiar with xsltproc--this xslt is actually written to be an
export filter for OpenOffice. In Writer open Tools - XML Filter
Settings... and click onĀ  New... to install a new filter. Name it and
then clock on the Transformation tab. Add the file path to the xslt to
XSLT for Export and click OK. Then you can export as osis, albeit with
only a basic set of elements available. <br>
<br>
I tried your suggestion, and it worked! Thank you so much. Who knew it
could be so easy? I really need to read up more on XPath and XSLT so I
know a bit more about what I'm doing...<br>
<br>
Daniel <br>
</font><br>
Greg Hellings wrote:
<blockquote
 cite="mid:75a952c00802061732x19effedx6cc81710ddaa7a8a@mail.gmail.com"
 type="cite">
  <pre wrap="">Daniel,

I'm using xsltproc to run the transformation now, and I am receiving
an error - it seems that one of the two documents has a bit of a
problem with its formatting.  I get the following error - have you
received it, or how else are you using the XSLT?  Perhaps it is
supposed to be a plugin directly to OpenOffice that I'm unaware of?

compilation error: file oowriter2osis.xsl element text
misplaced text node: '
--&gt;
'

--Greg

On Feb 6, 2008 7:20 PM, Daniel Owens <a class="moz-txt-link-rfc2396E" href="mailto:dhowens@pmbx.net">&lt;dhowens@pmbx.net&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap=""> Greg,

 Just change the file extension from .ott to .zip and open it as a ZIP
archive. Look at content.xml, and you will see how the document is
structured. I will try your suggestion.

 Daniel



 Greg Hellings wrote:
 Daniel,

I am unable to get the .ott or a .odt of the template to open in
anything that even vaguely resembles XML format. Thus I am unable to
really test my suggestion. Since a call to &lt;xsl:apply-templates&gt; is
working from the same context just a few lines below - try applying
&lt;xsl:apply-templates /&gt; rather than using &lt;xsl:value-of ...&gt; if you
don't know how to make the XPath work. If I had a copy of the sample
document or access to the DOM/Schema that was being used for these
documents, then I would be able to suggest an XPath expression.

Cheers,
Greg

On Feb 6, 2008 6:48 PM, Daniel Owens <a class="moz-txt-link-rfc2396E" href="mailto:dhowens@pmbx.net">&lt;dhowens@pmbx.net&gt;</a> wrote:


 Greg,

 Thanks for your response.

 I thought the XSL looked cumbersome, but since I am at the level of trial
and error with xsl (read: comment out and see what affects the output), I am
relying heavily on what others have done. It may be cumbersomely written,
but it is effective for my purposes. Feel free to offer suggestions for how
to simplify...

 For the issue at hand, I didn't specify this, but I was aware that
 &lt;xsl:value-of select="***" /&gt;


 was the culprit. I left "***" in there to remind myself and others that it
was at that specific spot that I was needing help (a trick used by an editor
I used to work with). My problem is I don't know how to form an XPath
expression to get what I want. I tried several ways (trial and error) to
find the right XPath expression but to no avail. This template is
transforming several styles at once (all the headers which make &lt;div&gt;
elements in OSIS), all beginning with text:h but with different outline
levels and styles in OpenOffice.

 I would be happy to read up more on XPath expressions, but I just don't
know where to look on this one. Any help in that regard would be
appreciated.

 Daniel



 Greg Hellings wrote:
 Daniel,

This is a very cumbersomely written XSL - I don't know why it doesn't
use the &lt;xsl:element&gt; tags and such for the creation of new elements
in the output. However, your problem is specified below.

On Feb 6, 2008 10:46 AM, Daniel Owens <a class="moz-txt-link-rfc2396E" href="mailto:dhowens@pmbx.net">&lt;dhowens@pmbx.net&gt;</a> wrote:


 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>).

 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:

 1 bookGroup
 2 x-unit
 3 book
 4 chapter
 5 section
 6 subSection

 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:

 &lt;div type="chapter" osisID="***"&gt;
 &lt;title&gt;Chapter 1&lt;/title&gt;
 &lt;/div&gt;

 I would like it to look like this:

 &lt;div type="chapter" osisID="Chapter 1"&gt;
 &lt;title&gt;Chapter 1&lt;/title&gt;
 &lt;/div&gt;

 How do I retrieve that text to place it in osisID?

 This is the relevant template (line 371 in the xsl file):
 &lt;xsl:template name="make-section"&gt;
 &lt;xsl:param name="current"/&gt;
 &lt;xsl:param name="prev"/&gt;
 &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;div&lt;/xsl:text&gt;
 &lt;xsl:text&gt; type=&amp;quot;&lt;/xsl:text&gt;
 &lt;xsl:value-of select="@text:style-name" /&gt;
 &lt;xsl:text&gt;&amp;quot;&lt;/xsl:text&gt;
 &lt;xsl:text&gt; osisID=&amp;quot;&lt;/xsl:text&gt;
 &lt;xsl:value-of select="***" /&gt;

 This line above here is the culprit - as you see, it is told to output
the value-of the string literal ***. You need to replace this with
the XPath expression to the location that "Chapter 1" (for example) is
being pulled from. A few lines down that is being pulled in by a call
to &lt;xsl:apply-templates&gt; but here you can just substitute the XPath to
where the text is provided in the original XML document.

--Greg



 &lt;xsl:text&gt;&amp;quot;&lt;/xsl:text&gt;
 &lt;xsl:call-template name="id.attribute.literal"/&gt;
 &lt;xsl:text disable-output-escaping="yes"&gt;&amp;gt;&lt;/xsl:text&gt;
 &lt;xsl:choose&gt;
 &lt;xsl:when test="$current &amp;gt; $prev+1"&gt;
 &lt;title/&gt;
 &lt;xsl:call-template name="make-section"&gt;
 &lt;xsl:with-param name="current" select="$current"/&gt;
 &lt;xsl:with-param name="prev" select="$prev+1"/&gt;
 &lt;/xsl:call-template&gt;
 &lt;/xsl:when&gt;
 &lt;xsl:otherwise&gt;
 &lt;title&gt;
 &lt;xsl:apply-templates/&gt;
 &lt;/title&gt;
 &lt;xsl:variable name="this"&gt;
 &lt;xsl:value-of select="generate-id()"/&gt;
 &lt;/xsl:variable&gt;
 &lt;xsl:for-each select="key('headchildren', $this)"&gt;
 &lt;xsl:if test="not(parent::text:h)"&gt;
 &lt;xsl:apply-templates select="."/&gt;
 &lt;/xsl:if&gt;
 &lt;/xsl:for-each&gt;
 &lt;xsl:choose&gt;
 &lt;xsl:when test="$current=1"&gt;
 &lt;xsl:apply-templates select="key('children1',
 generate-id())"/&gt;
 &lt;/xsl:when&gt;
 &lt;xsl:when test="$current=2"&gt;
 &lt;xsl:apply-templates select="key('children2',
 generate-id())"/&gt;
 &lt;/xsl:when&gt;
 &lt;xsl:when test="$current=3"&gt;
 &lt;xsl:apply-templates select="key('children3',
 generate-id())"/&gt;
 &lt;/xsl:when&gt;
 &lt;xsl:when test="$current=4"&gt;
 &lt;xsl:apply-templates select="key('children4',
 generate-id())"/&gt;
 &lt;/xsl:when&gt;
 &lt;xsl:when test="$current=5"&gt;
 &lt;xsl:apply-templates select="key('children5',
 generate-id())"/&gt;
 &lt;/xsl:when&gt;
 &lt;xsl:when test="$current=6"&gt;
 &lt;xsl:apply-templates select="key('children6',
 generate-id())"/&gt;
 &lt;/xsl:when&gt;
 &lt;/xsl:choose&gt;
 &lt;/xsl:otherwise&gt;
 &lt;/xsl:choose&gt;
 &lt;/xsl:template&gt;

 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.

 Daniel
 --
 PMBX license 1502

_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page


 _______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page



 --
PMBX license 1502


_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page


 _______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page



 --
PMBX license 1502


_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page

    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page

  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
PMBX license 1502 
</pre>
</body>
</html>