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: ' --> ' --Greg On Feb 6, 2008 7:20 PM, Daniel Owens <[EMAIL PROTECTED]> wrote: > > 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 <xsl:apply-templates> is > working from the same context just a few lines below - try applying > <xsl:apply-templates /> rather than using <xsl:value-of ...> 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 <[EMAIL PROTECTED]> 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 > <xsl:value-of select="***" /> > > > 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 <div> > 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 <xsl:element> 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 <[EMAIL PROTECTED]> 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 > http://www.tei-c.org/wiki/index.php/TEI_OpenOffice_Package and started > playing around (I know next to nothing about XSLT except what I could glean > from www.w3schools.com). > > 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: > > 1 bookGroup > 2 x-unit > 3 book > 4 chapter > 5 section > 6 subSection > > 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: > > <div type="chapter" osisID="***"> > <title>Chapter 1</title> > </div> > > I would like it to look like this: > > <div type="chapter" osisID="Chapter 1"> > <title>Chapter 1</title> > </div> > > How do I retrieve that text to place it in osisID? > > This is the relevant template (line 371 in the xsl file): > <xsl:template name="make-section"> > <xsl:param name="current"/> > <xsl:param name="prev"/> > <xsl:text disable-output-escaping="yes"><div</xsl:text> > <xsl:text> type="</xsl:text> > <xsl:value-of select="@text:style-name" /> > <xsl:text>"</xsl:text> > <xsl:text> osisID="</xsl:text> > <xsl:value-of select="***" /> > > 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 <xsl:apply-templates> but here you can just substitute the XPath to > where the text is provided in the original XML document. > > --Greg > > > > <xsl:text>"</xsl:text> > <xsl:call-template name="id.attribute.literal"/> > <xsl:text disable-output-escaping="yes">></xsl:text> > <xsl:choose> > <xsl:when test="$current > $prev+1"> > <title/> > <xsl:call-template name="make-section"> > <xsl:with-param name="current" select="$current"/> > <xsl:with-param name="prev" select="$prev+1"/> > </xsl:call-template> > </xsl:when> > <xsl:otherwise> > <title> > <xsl:apply-templates/> > </title> > <xsl:variable name="this"> > <xsl:value-of select="generate-id()"/> > </xsl:variable> > <xsl:for-each select="key('headchildren', $this)"> > <xsl:if test="not(parent::text:h)"> > <xsl:apply-templates select="."/> > </xsl:if> > </xsl:for-each> > <xsl:choose> > <xsl:when test="$current=1"> > <xsl:apply-templates select="key('children1', > generate-id())"/> > </xsl:when> > <xsl:when test="$current=2"> > <xsl:apply-templates select="key('children2', > generate-id())"/> > </xsl:when> > <xsl:when test="$current=3"> > <xsl:apply-templates select="key('children3', > generate-id())"/> > </xsl:when> > <xsl:when test="$current=4"> > <xsl:apply-templates select="key('children4', > generate-id())"/> > </xsl:when> > <xsl:when test="$current=5"> > <xsl:apply-templates select="key('children5', > generate-id())"/> > </xsl:when> > <xsl:when test="$current=6"> > <xsl:apply-templates select="key('children6', > generate-id())"/> > </xsl:when> > </xsl:choose> > </xsl:otherwise> > </xsl:choose> > </xsl:template> > > 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: sword-devel@crosswire.org > http://www.crosswire.org/mailman/listinfo/sword-devel > Instructions to unsubscribe/change your settings at above page > > > _______________________________________________ > sword-devel mailing list: sword-devel@crosswire.org > http://www.crosswire.org/mailman/listinfo/sword-devel > Instructions to unsubscribe/change your settings at above page > > > > -- > PMBX license 1502 > > > _______________________________________________ > sword-devel mailing list: sword-devel@crosswire.org > http://www.crosswire.org/mailman/listinfo/sword-devel > Instructions to unsubscribe/change your settings at above page > > > _______________________________________________ > sword-devel mailing list: sword-devel@crosswire.org > http://www.crosswire.org/mailman/listinfo/sword-devel > Instructions to unsubscribe/change your settings at above page > > > > -- > PMBX license 1502 > > > _______________________________________________ > sword-devel mailing list: sword-devel@crosswire.org > http://www.crosswire.org/mailman/listinfo/sword-devel > Instructions to unsubscribe/change your settings at above page > _______________________________________________ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page