Word 2003 XML document generation error

P

Pete

Hi,

I'm generating a Word 2003 document from an XML stream and a stylesheet.

I've defined an XSD schema and mapped that in to create the initial template
(after some messing around I had to add the mixed="true" attribute to allow
for the additional text in the document). However when I generate the
document with the resultant xsl it opens fine in Word but then cannnot be
saved afterwards.

I get the pink error squiggles "This is not allowed in this context"
against a number of areas. Funnily enough they seem to be against only some
areas which have some additional formatting or crlf's. When I look at the
XML structure of the document in the task pane two nodes are highlighted
with a yellow square & x.

Anyone have any ideas what is causing this?


Thanks


Pete
 
C

Cindy M -WordMVP-

Hi Pete,

My advice would be to recreate that section in a "real" Word document, "by
hand". Save this as in WordML format, then compare the XML code that generates
to what your xslt does.
I'm generating a Word 2003 document from an XML stream and a stylesheet.

I've defined an XSD schema and mapped that in to create the initial template
(after some messing around I had to add the mixed="true" attribute to allow
for the additional text in the document). However when I generate the
document with the resultant xsl it opens fine in Word but then cannnot be
saved afterwards.

I get the pink error squiggles "This is not allowed in this context"
against a number of areas. Funnily enough they seem to be against only some
areas which have some additional formatting or crlf's. When I look at the
XML structure of the document in the task pane two nodes are highlighted
with a yellow square & x.

Anyone have any ideas what is causing this?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
P

Pete

Cindy,

Thanks for that, after a day of testing and comparing I've found the
problem. I seem to be getting extra namespace information being inserted on
two of the document nodes. This is apparently causing the problem as when I
delete this namespace info the document can be saved as valId XML.

What I can't explain is why this namespace info is being added and only
added to these two nodes. The really strange part is that the namespace info
that's added is not defined in either the input xml or the xsl creating the
WordML document.

Nodes with added NS information:
<ns0:raw-material xmlns:ns0="http://www.myxyz.com/pvws/">
<ns0:suppliers xmlns:ns0=http://www.myxyz.com/pvws/>

All other nodes are fine e.g:
<ns0:supplier>

Any ideas why this might be happening?


Thanks



Pete
 
C

Cindy M -WordMVP-

Hi Pete,

Glad we're at least a bit closer to figuring this out :)

Are you certain that the namespaces are spelled correctly, and match upper and
lower case exactly to what's declared in the schema and the xml file
(suppliers vs. supplier, for example)? Nothing that could be interpreted as
non-unique, either?

I also have to ask myself why the URL in the one example you show is in
"quotes" and in the other it's not?
Thanks for that, after a day of testing and comparing I've found the
problem. I seem to be getting extra namespace information being inserted on
two of the document nodes. This is apparently causing the problem as when I
delete this namespace info the document can be saved as valId XML.

What I can't explain is why this namespace info is being added and only
added to these two nodes. The really strange part is that the namespace info
that's added is not defined in either the input xml or the xsl creating the
WordML document.

Nodes with added NS information:
<ns0:raw-material xmlns:ns0="http://www.myxyz.com/pvws/">
<ns0:suppliers xmlns:ns0=http://www.myxyz.com/pvws/>

All other nodes are fine e.g:
<ns0:supplier>

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
Top