xsl-list
[Top] [All Lists]

wordml to docbook (sect1-sect5)

2005-12-06 01:15:55
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-tag?and 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 don´t 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>