Automatic formatting of XML documents (Word 2007)

G

Guest

Hello:

We plan to create/edit XML documents following custom schemas using Word
2007. Is there a way to associate elements to word styles? is it done through
a dotx?

Basically, whenever we open an XML document (saved by word as docx), we want
formatting applied: e.g.,
- all <title>s appear bold, Arial, 12pt
- <figure><title>s appear centered, TNS, 10pt
- , etc...

Your guidance would be much appreciated. Best Regards, Lyteck
 
C

Cindy M.

Hi =?Utf-8?B?THl0ZWNr?=,
We plan to create/edit XML documents following custom schemas using Word
2007. Is there a way to associate elements to word styles? is it done through
a dotx?

Basically, whenever we open an XML document (saved by word as docx), we want
formatting applied: e.g.,
- all <title>s appear bold, Arial, 12pt
- <figure><title>s appear centered, TNS, 10pt
- , etc...
There's nothing built into Word that can do this, no.

You'd have to use a TRANSFORM to put valid WordProcessingML into the file
(either as its opening, or you can process without opening in Word). In order to
learn the correct syntax, apply the formatting/styles to tags in a document,
then view the XML result.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

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

Guest

Thanks Cindy, your confirmation and work around suggestion is most appreciated.

The fact that styles cannot be applied automatically to XML tags seems to be
an important omission.

A huge benefit of XML in Word 2007 would be to take advantage of structured
authoring. One critical benefit of structured authoring is of course to
enable constistent formatting of enterprise documents by separating content
from formatting; in effect, freeing authors from formatting tasks and letting
formatting be applied automatically based on element names, attributes and
context.

At this time (Word 2007 B2TR), it seems styles can only be applied manually
to individual elements. This is not practical for a large set of documents
and is likely to lead to formatting inconsistency across documents and
possibly within the same document. Cindy is suggesting a good but difficult
workaround to provide automation.

Does anyone know if the functionality to map styles to elements and save the
mapping as a configuration that can be reused for other XML documents
conforming to the same schema will be present when Word 2007 is officially
released?

Thanks,

Lyteck Lynhiavu
DIGITALENT
New York, NY

PS: I did notice the ability to attach a CSS to an XML document (under Word
2007>Developer>Schemas>Templates and Add-ins>Linked CSS tab) but I see the
benefit of using CSS over richer Word styles to format a document.
 
G

Guest

(typos corrected)
Thanks Cindy, your confirmation and workaround suggestion are most
appreciated.

The fact that XML tags cannot automatically be associated to styles seems to
be
a real shortcoming.

A huge benefit of XML in Word 2007 would be to take advantage of structured
authoring. One core benefit of structured authoring is of course to
enable constistent formatting of enterprise documents by separating content
from formatting; in effect, freeing authors from formatting tasks and letting
formatting be applied automatically based on element names, attributes and
context.

As of this writing (Word 2007 B2TR), it seems styles can only be applied
manually
to individual elements. This is not practical and is likely to lead to
formatting inconsistency across large sets of documents and even within the
same document. Cindy is suggesting a good but difficult workaround to provide
automation.

Does anyone know if the functionality to map styles to elements and save the
mapping as a configuration that can be reused for other XML documents
conforming to the same schema will be present when Word 2007 is officially
released?

Thanks,

Lyteck Lynhiavu
DIGITALENT
New York, NY

PS: I did notice the ability to attach a CSS to an XML document (under Word
2007>Developer>Schemas>Templates and Add-ins>Linked CSS tab) but I don't see
the benefit of using CSS over richer Word styles to format a document.
 
G

Guest

Cindy,
I think what you have suggested is a one time processing job using an XSL
transformation that applies styles to WordML elements.

However, I understand that this will not be helpful in a scenario where one
requires that Word styles be applied to the XML content on the fly as the
content is being authored in Word 2007. So for e.g. I author something in the
<title> element, it should by default appear in the style Heading 1 as soon
as I type the content.

Thanks,
Saurabh Aggarwal
Gurgaon
India
 
C

Cindy M.

Hi Saurabh,
I think what you have suggested is a one time processing job using an XSL
transformation that applies styles to WordML elements.

However, I understand that this will not be helpful in a scenario where one
requires that Word styles be applied to the XML content on the fly as the
content is being authored in Word 2007. So for e.g. I author something in the
<title> element, it should by default appear in the style Heading 1 as soon
as I type the content.
If the document is already set up with the XML elements, then the formatting can
already have been applied to them. Then text typed into them will have the
formatting. In Word 2007 this can also be done using Content Controls.

If the user is expected to insert the XML elements while he works, then you need
to provide an programmed interface (Ribbon or task pane) that will take care of
inserting the elements and formatting them with the required style.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top