xsl-list
[Top] [All Lists]

RE: [xsl] Batch Transforming help

2006-04-27 16:33:43
Check out Ant (http://ant.apache.org/)
-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Gary E. Daniels <gdaniels(_at_)askdata(_dot_)net>
Sent:     Thu, 27 Apr 2006 16:01:53 -0500
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  [xsl] Batch Transforming help


Hello.  Newbie here looking for some guidance.  I've been searching for a 
way to "batch"

transform a number of XML files.  The information I've found appears to be 
the solution, but

I am having trouble understanding it.  I need some step-by-step 
instructions.  I am able to

"read" the contents of a folder or directory and have them appear in an XML 
file as shown

below (using HXDLG program files):

FILE #1

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hdlg:filesystem SYSTEM "http://www.hdlg.info/XML/filesystem.dtd";>
<hdlg:filesystem xmlns:hdlg="http://www.hdlg.info/XML/filesystem";>
    <hdlg:folder name="xmlbatch" url="file:/c:/xmlbatch/">
       <hdlg:file name="90500377.xml" size="2617748" type="unknown"

url="file:/c:/xmlbatch/90500377.xml">
       </hdlg:file>
       <hdlg:file name="90500385.xml" size="2425096" type="unknown"

url="file:/c:/xmlbatch/90500385.xml">
       </hdlg:file>
       <hdlg:file name="90500388.xml" size="2659608" type="unknown"

url="file:/c:/xmlbatch/90500388.xml">
       </hdlg:file>
       <hdlg:file name="90500412.xml" size="2319619" type="unknown"

url="file:/c:/xmlbatch/90500412.xml">
       </hdlg:file>
       <hdlg:file name="90500417.xml" size="3388378" type="unknown"

url="file:/c:/xmlbatch/90500417.xml">
       </hdlg:file>
       <hdlg:file name="90500452.xml" size="2629500" type="unknown"

url="file:/c:/xmlbatch/90500452.xml">
       </hdlg:file>
       <hdlg:file name="90500464.xml" size="2452754" type="unknown"

url="file:/c:/xmlbatch/90500464.xml">
       </hdlg:file>
    </hdlg:folder>
</hdlg:filesystem>


The following XSL Stylesheet is one I use to transform these files 
(90500377.xml,

90500385.xml, etc) one at a time:


FILE #2

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

<xsl:output method="xml"/>

<xsl:template match="filename"/>
<xsl:template match="mimetype"/>
<xsl:template match="mimedata"/>

<xsl:template match="AppraisalForm">

<!-- Use this 1st to extraxct from the NOVA Form.  Save results as 
Copyresults.xml -->
<!-- Use XSL sheet #2 to take results from Copyresults.xml and put them in 
order. -->



<!-- Select specific Node or Form based on its id --><xsl:if test="@id='W1S'">
File #<xsl:copy-of select="field[(_at_)id='4']"/>|
Address <xsl:copy-of select="field[(_at_)id='1001']"/>|
City <xsl:copy-of select="field[(_at_)id='1002']"/>|
</xsl:if>

<!-- Select a different specific Node or form based on its id --><xsl:if 
test="@id='W2S'">
Water <xsl:copy-of select="field[(_at_)id='14116']"/>|
Sewer <xsl:copy-of select="field[(_at_)id='14126']"/>|
Heat <xsl:copy-of select="field[(_at_)id='14127']"/>|
</xsl:if>

<!-- Select a different specific Node or form based on its id --> <xsl:if 
test="@id='W4S'">
OAR SP <xsl:copy-of select="field[(_at_)id='60293']"/>|
GIM SP <xsl:copy-of select="field[(_at_)id='60291']"/>|
Sale Date <xsl:copy-of select="field[(_at_)id='60016']"/>|
</xsl:if>

<!-- Select a different specific Node or form based on its id --><xsl:if 
test="@id='W5S'">
Vac Percent <xsl:copy-of select="field[(_at_)id='80090']"/>|
</xsl:if>

<!-- Select a different specific Node or form based on its id --><xsl:if 
test="@id='W7S'">
Year <xsl:copy-of select="field[(_at_)id='150955'][1]"/>|
Source <xsl:copy-of select="field[(_at_)id='152539']"/>|
Rental Inc <xsl:copy-of select="field[(_at_)id='150982']"/>|
Laundry <xsl:copy-of select="field[(_at_)id='150984']"/>|
</xsl:if>


<!-- Select a different specific Node or form based on its id --><xsl:if 
test="@id='WSA'">
OAR Val <xsl:copy-of select="field[(_at_)id='97015']/value"/>|
GIM Val <xsl:copy-of select="field[(_at_)id='97000']/value"/>|
Value <xsl:copy-of select="field[(_at_)id='150615']/value"/>|
</xsl:if>


</xsl:template></xsl:stylesheet>


How do I modify the above XSL Stylesheet (FILE #2) to batch transform the 
files in FILE #1?
I have been using XFactor (Saxon) to load the single files and transform 
them.  Will I need

to run the batch process from the command line?  If so, I need to know what 
I need to type

in the command line and also what folders (directories) I need to create 
and what files need

to be placed into those folders (directories).

Or, is there an inexpensive editing/parser program that has batch 
processing capabilities?

Thanks in advance for your assistance.

Gary



Gary E. Daniels
Cornerstone Appraisal Company
500 Selkirk Drive
Schaumburg, IL. 60194
847 882-5892  Fax 847 882-5963
mailto:gdaniels(_at_)ais(_dot_)net
http://www.askdata.net


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>