[xsl] WordML to XML Header Problem

Subject: [xsl] WordML to XML Header Problem
From: "Byomokesh Sahoo" <sahoo.byomokesh@xxxxxxxxx>
Date: Mon, 13 Oct 2008 11:37:31 +0530
Hi,

I am doing WordML to XML. I am getting header problem. I am trying
[xsl:for-each-group select="*" group-starting-with...] but could not
find out the right way.
Input XML
=======
<w:body><wx:sect><wx:sub-section>
<w:p wsp:rsidR="00000000" wsp:rsidRDefault="00AD3645">
<w:pPr><w:pStyle w:val="ChapterLabel"/></w:pPr>
<w:r>
<w:t>1</w:t></w:r></w:p><aml:annotation aml:id="0"
w:type="Word.Bookmark.Start" w:name="OLE_LINK25"/><aml:annotation
aml:id="1" w:type="Word.Bookmark.Start"
w:name="OLE_LINK26"/></wx:sub-section><wx:sub-section>
<w:p wsp:rsidR="00000000" wsp:rsidRDefault="00AD3645">
<w:pPr><w:pStyle w:val="ChapterTitle"/></w:pPr>
<w:r><w:t>A Brief Introduction</w:t></w:r><aml:annotation aml:id="0"
w:type="Word.Bookmark.End"/><aml:annotation aml:id="1"
w:type="Word.Bookmark.End"/></w:p>
<w:p wsp:rsidR="00000000" wsp:rsidRDefault="00AD3645">
<w:pPr><w:pStyle w:val="BodyText"/></w:pPr>
<w:r><w:t>Active Directory (AD) is Microsoftbs network operating
system (NOS</w:t></w:r>
<w:r><w:fldChar w:fldCharType="begin"/></w:r>
<w:r><w:instrText>XE "operating systems:NOS"</w:instrText></w:r>
<w:r><w:fldChar w:fldCharType="end"/></w:r><w:r><w:t>), built on top
of enables administrators to manage enterprise-wide
info</w:t></w:r><w:r><w:t>rmation distributed.</w:t></w:r>
<w:p wsp:rsidR="00000000" wsp:rsidRDefault="00AD3645"><w:pPr><w:pStyle
w:val="Heading1"/></w:pPr><w:r><w:t>Evolution of the Microsoft
NOS</w:t></w:r></w:p>
<w:p wsp:rsidR="00000000" wsp:rsidRDefault="00AD3645"><w:pPr><w:pStyle
w:val="BodyText"/></w:pPr>
<w:r>
<w:t>Network operating system</w:t></w:r>
<w:r></w:p></wx:sub-section></wx:sect></w:body>

Required Output
============
<chapter id="a brief introduction">
<label>1</label>
<title>A Brief Introduction</title>
<p>Active Directory (AD) is (NOSXE "operating systems:NOS"), built on
top of distributed.</p>
<section1>
<title>Evolution of the Microsoft NOS</title>
<p>Network operating system, or which various types of resources,
such as user, group, and</p>
<!--
<section2> or <section3> .....like this
-->
</section3>
</section2>
</section1>
</chapter>
==========
XSL
===
<xsl:template match="w:p">
    <xsl:for-each-group select="*"
group-starting-with="w:pPr/w:pStyle[@w:val='ChapterTitle']">
       <section1>
<xsl:value-of select="current-group()[1]" />
<title><xsl:value-of select="current-group()[2]" /></title>
           <xsl:for-each-group select="current-group()[position()
&gt; 2]" group-starting-with="w:pPr/w:pStyle[@w:val='Heading1']">
               <section2>
<xsl:value-of select="current-group()[1]"/>
<xsl:value-of select="current-group()[2]" />
                   <xsl:for-each-group
select="current-group()[position() &gt; 2]"
group-starting-ith="w:p[w:pPr/w:pStyle/@w:val='Heading1']">
       <section3>
<xsl:value-of select="current-group()[1]" />
<xsl:value-of select="current-group()[2]" />
       </section3>
                   </xsl:for-each-group>
 </section2>
           </xsl:for-each-group>
       </section1>
    </xsl:for-each-group>
</xsl:template>

Please anyone give me some guidance how could archive this.

Thanks
Byomokesh Sahoo

Om Trayambakam Yajaamahe Sugandhim Pushtivardhanam
Urvaarukamiva Bandhanan Mrytor Muksheeya Mamritaat

Current Thread