[xsl] Convert Word XML to Hierarchical XML using XSLT

Subject: [xsl] Convert Word XML to Hierarchical XML using XSLT
From: "Rod Coate" <Rod.Coate@xxxxxxxxxxxxxxxxx>
Date: Fri, 16 Sep 2005 10:40:05 +0100
Hi,
This is my first post on this list and I need a bit of help with some XSL.

The tools I am using are word 2000 and Altova XML Spy.

I have a series of word documents that are formatted so that the import
function of XML Spy produces xml as per the example at the end of this post.
I am trying to process this into a specific xml so that I can then import it
into a database. (Target XML sample after the Word XML sample)

I need a bit of Guidance as to how to approach this problem. If I was coding
in VBA then I could just count and compare Heading levels, but how do I do
this in XSL?

I hope that this makes sense.

Help!

Rod

-------------------------------------------------------------
Word XML
-------------------------------------------------------------
<Word-Document >
	<Heading1>
		<p>Heading Level One</p>
	</Heading1>
	<Heading2>
		<p>Heading Level Two</p>
	</Heading2>
	<Heading3>
		<p>Category1</p>
	</Heading3>
	<Normal>
		<p>Category 1 Text</p>
		...
	</Normal>
	<Heading3>
		<p>Category2</p>
	</Heading3>
	<Normal>
		<p>Category 2 Text</p>
		...
	</Normal>
	...
	<Heading2>
	...
</Word-Document>
-------------------------------------------------------------
Target XML
-------------------------------------------------------------
<Heading1>
	<Title>Heading Level One</Title>
	<Data>
		<Heading2>Heading Level 2</Heading2>
		<Category1>
			Category 1 Text
			...
		</Category1>
		<Category2>
			Category 2 Text
			...
		</Category2>
		...
		<CategoryN>
			Category N Text
			...
		</CategoryN>
	</Data>
	<Data>
		...
	</Data>
</Heading1>
-------------------------------------------------------------

Current Thread