XSLT style creation

B

bob_hymee

I have some XML that I would like to format as a normal page. Is it possible
to style XML data in Microsoft Word? By style I mean apply stuff like font
bolding, carriage returns, and indenting to what is in the element tags of
the XML. I'd like to style it and then save that styling and apply it to a
new set of XML that has the same structure but different data within its
tags. In other words the output should be like a regular document just that
it happens to have an underlying structure of user defined XML. Again, in
order to truly do what I need to have done it should be able to appy that
same formatting to a new imported XML document as long as the element tags
are the same.

Example:

Input -
<Name>Bob</Name>
<Profession>Programmer</Programmer>

Output -
Bob: Programmer
 
C

Cindy M -WordMVP-

Hi Bob,

I'm not certain we're on the same wave-length, here, but...

Yes, you can transform XML to something Word can open and display with
formatting. Exactly what depends on the target version of Word. If we're talking
about Word 2003, then there's WordProcessingML, Word's "native" XML vocabulary.
This is documented on microsoft.com (more or less).

For earlier versions of Word you'd have to transform to RTF or to Word's
round-trip HTML. The RTF spec is available on microsoft.com

WordProcessingML for earlier versions of Word will only be possible after Office
2007 is released. The new file formats for the up-coming version are XML, and MS
will be providing a converter so that Office 2000 and upwards can open and save
as Office 2007 XML file format.
I have some XML that I would like to format as a normal page. Is it possible
to style XML data in Microsoft Word? By style I mean apply stuff like font
bolding, carriage returns, and indenting to what is in the element tags of
the XML. I'd like to style it and then save that styling and apply it to a
new set of XML that has the same structure but different data within its
tags. In other words the output should be like a regular document just that
it happens to have an underlying structure of user defined XML. Again, in
order to truly do what I need to have done it should be able to appy that
same formatting to a new imported XML document as long as the element tags
are the same.

Example:

Input -
<Name>Bob</Name>
<Profession>Programmer</Programmer>

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :)
 
B

bob_hymee

This is what I would like to have done.

1. Bring in the XML
Example:
<FirstName>John</FirstName>
<LastName>Doe</LastName>

2. Have Writer treat the data within the XML as plain text.
Example: "John Doe" or "JohnDoe" even.

3. Format that text using traditional Writer tools. In other words one
could highlight "John Doe", bold it by clicking the icon, and Word would
know that everywhere that the element tags <FirstName> and <LastName> exist
the contents of those tags should be bolded.

4. Be able to save that formatting.
Explination: Now that I have defined the styling, I would like to be able to
bring in another XML document of the same format and have Writer know how to
make it look.
Input:
<FirstName>Billy</FirstName>
<LastName>Bob</LastName>
Should become:
Billy Bob (where Billy Bob is bolded)

I want to be able to have a user who does not have an indepth knowledge of
XSLTs to be able to create one using the tools of Word that they are already
familiar with and be able to transfer that styling to another XML document
that contains the same elements but different data within its tags.

I belive that this sort of functionality does not currently exist in Word.
If it did it would help extend the XML as the standard for data. I know of
certain businesses and government divisons that would value this sort of
ability
 
C

Cindy M -WordMVP-

Hi bob,

Mmm, no, Word can't do exactly what you describe in the way you describe it.

The closest you can get would be to use SCHEMAS. Provide a schema that
accurately describes the data in the XML files your data source would provide.
In Tools/Templates and Addins/XML Schemas the schema can be added to the
"schema library". If necessary/desired it can also be associated with a
transform ("solution").

Now the user can set up a document and choose the schema from the "library".
From the XML Structure task pane he can add any fields defined in the schema.
Sort of like setting up a mail merge, but with XML tags. They can be formatted
however he likes; copied to other documents also associated with the same
schema. The user should save the document as Word XML.

If the schema has been associated with a transform, the transform should be
available when the document is next opened. The transform can then fill in the
data.

Or, you can provide code that fills in the data. Say, a UserForm and the user
can choose a customer, whose data is entered into the document.

A variation on that theme would be to turn the document into a "Smart
Document". Then you can use a "document actions" pane (a task pane you define)
to provide contextual help and tools / XML tag.
This is what I would like to have done.

1. Bring in the XML
Example:
<FirstName>John</FirstName>
<LastName>Doe</LastName>

2. Have Writer treat the data within the XML as plain text.
Example: "John Doe" or "JohnDoe" even.

3. Format that text using traditional Writer tools. In other words one
could highlight "John Doe", bold it by clicking the icon, and Word would
know that everywhere that the element tags <FirstName> and <LastName> exist
the contents of those tags should be bolded.

4. Be able to save that formatting.
Explination: Now that I have defined the styling, I would like to be able to
bring in another XML document of the same format and have Writer know how to
make it look.
Input:
<FirstName>Billy</FirstName>
<LastName>Bob</LastName>
Should become:
Billy Bob (where Billy Bob is bolded)

I want to be able to have a user who does not have an indepth knowledge of
XSLTs to be able to create one using the tools of Word that they are already
familiar with and be able to transfer that styling to another XML document
that contains the same elements but different data within its tags.

I belive that this sort of functionality does not currently exist in Word.
If it did it would help extend the XML as the standard for data. I know of
certain businesses and government divisons that would value this sort of
ability


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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