Altova Mailing List Archives


Re: [xsl] wordml to docbook (sect1-sect5)

From: Steve Ball <Steve.Ball@-------------->
To:
Date: 12/7/2005 4:00:00 AM
Silvia,



Bob Stayton and I have already written a set of XSL stylesheets for
doing the conversion of WordML to DocBook, as well as the reverse
DocBook-to-WordML.  These stylesheets may be found in the DocBook
SourceForge project - http://docbook.sf.net/.

Unfortunately, they are not in the public distribution yet, but will
be in the next release.  For the moment, you can get the files from
the CVS repository or you can grab the snapshot build from http://
docbook.sourceforge.net/snapshots/

HTHs,
Steve Ball

---



Steve Ball            |   XSLT Standard Library   | Training & Seminars
Explain         |     Web Tcl Complete      |   XML XSL Schemas
http://www.explain.com.au/ |      TclXML TclDOM        | Tcl, Web
Development
Steve.Ball@xxxxxxxxxxxxxx  +---------------------------
+---------------------
Ph. +61 2 6242 4099   |   Mobile (0413) 594 462   | Fax +61 2 6242 4099


On 06/12/2005, at 7:15 PM, Silvia Liberto wrote:



Hello!



I want to transform a wordml document into a docbookXML document!
i use xsl 1.0. At the moment I have the problem to create sections
like
sect1 to sect5!

I want to make a construction like this:



<sect1>



      <title>title one with the style: ueberschrift1</title>



      <para>text etc.</para>



      <table>



      



      </table>



      <sect2>



            <title> second title with the style: ueberschrift2</title>



            <para> text etc. </para>



            <itemizedlist>



            



            </itemizedlist>



            <sect3>



<title>third title with the style: ueberschrift3</title>



<para> text etc. </para>



                  <itemizedlist>



                  



                  </itemizedlist>



            </sect3>



      </sect2>



</sect1>



<sect1>



<title>another title with style: ueberschrift1</title>



      <para>text etc.</para>



      <table>



      



      </table>



</sect1>



In my xml file I have styles for headings like ueberschrift1 till
ueberschrift5.

So my problem is, if for example the style ueberschrift1 is in my
xml
document, I want to set the tag sect1 and the whole content
between this
style and the next should be in this tag. When the next tag is
coming for
example ueberschrift2 another tag->sect2 should be opend inside
the
sect1-tagand when no tag is coming any more, first sect2 and then
sect1 shoud be closed.


I have tried so many things and the last experiment was this:



At this position: XXX  i don4t know how to say that the next following
elements should be written down like itemizedlist etc. before closing
The <sect2> and <sect1>..tag!? Have someone an idea?

<xsl:template match="w:p" mode="sect-begin">



        <sect1>
                <title>
                      <xsl:value-of select="w:r/w:t"/>
                </title>
                      <xsl:apply-templates select="." mode="next-
sect">
                      <xsl:with-param name="level"
select="number(substring(w:pPr/w:pStyle/@w:val,13))"/>
		      </xsl:apply-templates>
        </sect1>
</xsl:template>





 <xsl:template match="w:p" mode="next-sect">



         <xsl:param name="level"/>
         <xsl:variable name="next_p"
select="following-sibling::w:p[node()][1]/w:pPr/w:pStyle/@w:val"/>
         <xsl:variable name="next_p_num"
select="number(substring($next_p,13))"/>
                 <xsl:if test="$next_p_num=$level+1">
                             <sect2>
                                  <title>
                                       <xsl:value-of
select="following-sibling::w:p[node()][1]/w:r/w:t"/>

                                  </title>



                                                XXX



                              </sect2>
                  </xsl:if>


thanks very much!
kind regards
silvia

--
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse f|r Mail, Message, More +++

--
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen f|r GMX Partner: http://www.gmx.net/de/go/partner

--
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen f|r GMX Partner: http://www.gmx.net/de/go/partner

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.