Spinner Software logo Home News Products Buy online Solutions Contact us
Sitemap About Download Support Services Feedback

How to publish XML files to HTML files.

Download Microsoft XML 4.0 SP2 (or, at a minimum, msxml.msi) from ->Microsoft's site and install it.

Create a new directory (in the example C:\GenXML\ is used), and copy msxsl.exe to that directory. Then create the following 3 files in C:\GenXML\ :

Publish Directory.cmd

@ECHO OFF
@ECHO.
@ECHO Publishing XML files in directory:
CD
MD _Html
@ECHO.
For %%i IN (*.xml) DO CALL C:\GenXML\PublishFile-msxsl.cmd %%~pi %%~ni
@ECHO.
@ECHO Completed PublishDirectory
@ECHO.
PAUSE

Publish Path.cmd

@ECHO OFF
@ECHO.
@ECHO Publishing XML files in directory and all subdirectories:
CD
@ECHO.
For /D %%d IN (*.*) DO FOR %%i IN (%%~fd\*.xml) DO CALL C:\GenXML\PublishFile-msxsl.cmd %%~pi %%~ni
@ECHO.
@ECHO Completed PublishDirectory
@ECHO.
PAUSE

publishfile-msxsl.cmd

@ECHO OFF
IF "%1" == "" GOTO HLP
IF "%2" == "" GOTO HLP
@ECHO Publishing XML file: %1\%2.xml
IF NOT EXIST %1\_html MD %1\_Html
C:\GenXML\msxsl.exe -o %1\_html\%2.html -pi %1\%2.xml
GOTO End
:HLP
@ECHO.
@ECHO Syntax:
@ECHO PublishFile-msxsl Path Filename
@ECHO.
:END
REM PAUSE

Using the scripts

You can now create shortcuts to run the command files. You only need to determine two things: which command file to use, and the Working directory for the shortcut. The working directory becomes the current directory when the script is executed, and all files in that directory (and optionally all subdirectories) are then published into _html\*.html files.

Shortcut: Publish Path

Target: "C:\GenXML\Publish Path.cmd"
Working directory: C:\Intranet\MyXMLFiles\

Shortcut: Publish Directory

Target: "C:\GenXML\Publish Directory.cmd"
Working directory: C:\Intranet\MyXMLFiles\

--------------------------------------------------------------------------------

(c) 2004 Nicolai Kjaer, Spinner Software B.V.

http://www.spinnersoftware.com


Copyright 1997-2004 Spinner Software BV (www.spinnersoftware.com).

Home | Products | Buy Online | Privacy statement | Price policy | About Spinner | Contact Us | Search

This page is fully HTML 4.01 and CSS compliant. Please email the webmaster if you encounter any problems with this site.