How to apply XSL automatically

C

CD

I need to open an XML data file in word2003, then apply an
XSL to the XML, then save as a .Doc , How can this be done
automatically using VBA? Where should I keep the code, in
a template maybe?
Thanks!
CD
 
L

Lars-Eric Gisslén

The way we have solved that problem is by creating a solution (manifest
file) with only XSL files for a specific NameSpace. Attach the solution to
Word and that's it.

The requirement is that your XML file has a default NameSpace. When you open
the XML file in Word it recognize that you have a solution for that
NameSpace and will automatically apply the first transform you have in the
solution for that NameSpace. Each transform is then listed in the taskpane
so by just clicking on the names of the transforms you can instantly change
between different views of the same XML data. VBA is not involved at all.

Regards,
Lars-Eric
 
C

CD

Thank you for the reply. It sounds a very good approach. I am working on the manifest file now. Would you like to share some of the code in your manifest file.
Thanks again!
CD
 
L

Lars-Eric Gisslén

I have the files at my job so I can't show you any code before next week.

Regards,
Lars-Eric

CD said:
Thank you for the reply. It sounds a very good approach. I am working on
the manifest file now. Would you like to share some of the code in your
manifest file.
 
L

Lars-Eric Gisslén

This is the Mainfest file I use as a template for transform solutions. It
contains two transforms and one schema
--------------------------------
<manifest
xmlns="http://schemas.microsoft.com/office/xmlexpansionpacks/2003">
<version>1.0</version>
<updateFrequency>20160</updateFrequency>

<!--<uri>"http://schemas.microsoft.com/office/xmlexpansionpacks/2003/mostl"<
/uri>-->
<uri>www.signon.se/rfv/xsltest</uri>
<solution>
<solutionID>TransformTest1-XSL</solutionID>
<type>transform</type>
<alias>Transform for www.signon.se/rfv/xsltest namespace</alias>
<context>http://schemas.microsoft.com/office/word/2003/wordml</context>
<file>
<type>primaryTransform</type>
<version>1.0</version>
<filePath>MailTrans1.xsl</filePath>
</file>
</solution>
<solution>
<solutionID>TransformTest2-XSL</solutionID>
<type>transform</type>
<alias>Transform 2 for www.signon.se/rfv/xsltest namespace</alias>
<context>http://schemas.microsoft.com/office/word/2003/wordml</context>
<file>
<type>primaryTransform</type>
<version>1.0</version>
<filePath>MailTrans2.xsl</filePath>
</file>
</solution>
<solution>
<solutionID>TransformTest-1ED7D88393F5</solutionID>
<type>schema</type>
<alias>Transform Test</alias>
<file>
<type>schema</type>
<version>1.0</version>
<filePath>TestTransform.xsd</filePath>
</file>
</solution>
</manifest>
 

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