[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Convert Word XML to Hierarchical XML using XSLT

Subject: RE: Convert Word XML to Hierarchical XML using XSLT
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 16 Sep 2005 11:40:08 +0100
xslt word xml
Joris has given you the classic XSLT 1.0 solution based on recursing over
the sibling axis. Since XML Spy has (at least some) XSLT 2.0 support, you
could also use <xsl:for-each-group group-starting-with>. Your problem is
very similar to the example in the spec

Example: Identifying a Group by its Initial Element
at http://www.w3.org/TR/xslt20/#grouping-examples

except that you need to apply the solution to each of several levels.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Rod Coate [mailto:Rod.Coate@xxxxxxxxxxxxxxxxx] 
> Sent: 16 September 2005 10:40
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Convert Word XML to Hierarchical XML using XSLT
> 
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.