Discussion:
Word 2003 XSL Table
(too old to reply)
Muhammad Amjad
2005-09-12 17:01:14 UTC
Permalink
Hi there,
+ Created a Word document (e.g. Student.doc).
+ Attached a Schema to it (e.g. Student.xsd).
+ Drew a Table with 2 Rows and 2 Columns.
+ Added the root Tag to whole document (e.g. <student>).
+ Inserted Headings in the 1st row (e.g. Name, Age).
+ Inserted Tags from the Schema in each column of 2nd row (e.g.
<sname>, <sage>).
+ Saved the document As XML with Word ML (e.g. StudentML.xml).
+ Again saved the document As XML with Data Only option (e.g.
StudentDataOnly.xml).
+ Used the WML2XSLT.exe to generate Student.XSL from StudentML.xml as
follows;
D:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft
Office 2003 WordprocessingML Transform Inference Tool>wml2xslt.exe
C:\StudentML.xml

+ Edited the StudentDataOnly.xml to put more values (just copied the
sname and sage elements once again).
+ Opened the StudentDataOnly.xml in Word 2003 and applied the transform
i.e. Student.XSL.
+ The output is not according to my expectations. It created 2 more
cells in the same row and puts the values there. However it should have
created another row and put name and age there.

Any ideas?

I am using Word 2003 and Word XML SDK. Thanks for you help.

Cordially,
M.Amjad
Waqar Ahmed
2005-09-15 05:18:01 UTC
Permalink
You need to repeat your student node along with its sub nodes in xml doc.
Since your student is root element in xml doc so it wont get repeated, so
first of all take your student node out of root, secondly in your word doc
let the nodes in table as they are. Now the repeated student nodes in xml doc
will create two different rows in resulting table.
Post by Muhammad Amjad
Hi there,
+ Created a Word document (e.g. Student.doc).
+ Attached a Schema to it (e.g. Student.xsd).
+ Drew a Table with 2 Rows and 2 Columns.
+ Added the root Tag to whole document (e.g. <student>).
+ Inserted Headings in the 1st row (e.g. Name, Age).
+ Inserted Tags from the Schema in each column of 2nd row (e.g.
<sname>, <sage>).
+ Saved the document As XML with Word ML (e.g. StudentML.xml).
+ Again saved the document As XML with Data Only option (e.g.
StudentDataOnly.xml).
+ Used the WML2XSLT.exe to generate Student.XSL from StudentML.xml as
follows;
D:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft
Office 2003 WordprocessingML Transform Inference Tool>wml2xslt.exe
C:\StudentML.xml
+ Edited the StudentDataOnly.xml to put more values (just copied the
sname and sage elements once again).
+ Opened the StudentDataOnly.xml in Word 2003 and applied the transform
i.e. Student.XSL.
+ The output is not according to my expectations. It created 2 more
cells in the same row and puts the values there. However it should have
created another row and put name and age there.
Any ideas?
I am using Word 2003 and Word XML SDK. Thanks for you help.
Cordially,
M.Amjad
Loading...