[xsl] wordml to docbook (sect1-sect5)

Subject: [xsl] wordml to docbook (sect1-sect5)
From: "Silvia Liberto" <SLiberto@xxxxxx>
Date: Tue, 6 Dec 2005 09:15:55 +0100 (MET)
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

Current Thread