[Home] [By Thread] [By Date] [Recent Entries]
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[@id='4']"/>| Address <xsl:copy-of select="field[@id='1001']"/>| City <xsl:copy-of select="field[@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[@id='14116']"/>| Sewer <xsl:copy-of select="field[@id='14126']"/>| Heat <xsl:copy-of select="field[@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[@id='60293']"/>| GIM SP <xsl:copy-of select="field[@id='60291']"/>| Sale Date <xsl:copy-of select="field[@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[@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[@id='150955'][1]"/>| Source <xsl:copy-of select="field[@id='152539']"/>| Rental Inc <xsl:copy-of select="field[@id='150982']"/>| Laundry <xsl:copy-of select="field[@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[@id='97015']/value"/>| GIM Val <xsl:copy-of select="field[@id='97000']/value"/>| Value <xsl:copy-of select="field[@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@xxxxxxx http://www.askdata.net
|

Cart



