[xsl] WordML Question and normalize-space() question

Subject: [xsl] WordML Question and normalize-space() question
From: Jordan Soet <jds@xxxxxxxxxxxxxxxxxx>
Date: Fri, 19 May 2006 16:08:01 +0800
First my normalize-space() question... I'm wondering if it's possible to
normalize all the space without removing the leading and trailing

Next, I'm trying to perform conversion from an xml format which contains
XHTML to WordML and I'm having trouble figuring out how to deal with
formatting such as bold, italics, etc. First though, I'm also just having
specific WordML problems, and I was wondering if anyone knew of a list where
I could ask WordML questions on.

Anyways, obviously in XHTML these kind of things can be added to be nested
in each other, such as:

<b> bold text <i> bold and italic </i> just bold again </b>

however, in WordML, it's all a flat structure, so you need to do something

<w:r><w:rPr><w:b/></w:rPr><w:r><w:t>bold text</w:t></w:r>
<w:r><w:rPr><w:b/><w:i/></w:rPr><w:r><w:t>bold and italic</w:t></w:r>
<w:r><w:rPr><w:b/><w:i/></w:rPr><w:r><w:t>bold again</w:t></w:r>

I currently deal with it by calling a template from each formatting element
(b, i, etc.) which checks all its ancestors to see if there's any of the
formatting elements above it, and then applies it to the text() node, and
then calls apply-templates to everything below it, like follows:

			<xsl:if test="ancestor-or-self::xhtml:u">
				<w:u w:val="single"/>
				<w:color w:val="0000FF"/>
				<w:u w:val="single"/>
		<w:t><xsl:value-of select="text()"/></w:t>


However, this only works if the text is immediately nested inside the
elements, like this:

<b><i>bold and italic text</b></i>

and not in cases like the earlier example, where I then end up with
something like the following:

<b> bold text just bold again</b><b><i>bold and italic</b></i>

And I'm not really sure how to fix it.

So, hopefully that made sense, and any help is appreciated,


Current Thread