This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: saxon in batch file for lots and lots of xml files


I'd be cautious of using this approach with 500 files, because files are
held in memory for the duration of a transformation. Doing 500 separate
transformations is definitely better.

Mike Kay

> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of
> Alek Andreev
> Sent: 29 January 2002 20:03
> To: xsl-list@lists.mulberrytech.com
> Subject: RE: [xsl] saxon in batch file for lots and lots of xml files
>
>
> I ran into the same problem and I decided to change my batch file so
> that it created a temporary XML file pointing to all the
> other XML files
> to include.
>
> BuildAll.Bat (with line
> numbering)----------------------------------------------------
> ---------
> 1:	@echo off
> 2:	echo Building pages...
> 3:	echo ^<?xml version="1.0" encoding="UTF-8"?^> > _build.tmp
> 4:	echo ^<builds type="%1"^> >> _build.tmp
> 5:	for /r %x in (*.xml) do echo ^<build file="file:/%x"/^>
> >>c:\mywebsite\_build.tmp
> 7:	echo ^</builds^> >> _build.tmp
> 8:	xt   _build.tmp stylesheet.xsl
> 9:	del /e _build.tmp > nul
> 10:	echo Done.
> 11:	beep
> --------------------------------------------------------------
> ----------
> ---------------------------
>
> Put this file in your root XML folder.
> Things you need to customize:
> Line 5: change c:\mywebsite\ with the path where BuildAll.Bat resides.
> Line 8: change to reflect the syntax of your XSL processor
>
> This will produce a file, called _build.tmp which looks like:
> _build.tmp----------------------------------------------------
> ----------
> -------------------------
> <?xml version="1.0" encoding="UTF-8">
> <builds type="release">
> 	<build file="file:/c:/mysite/page1.xml"/>
> 	<build file="file:/c:/mysite/page2.xml"/>
> 	[snip]
> </builds>
> --------------------------------------------------------------
> ----------
> ---------------------------
>
> Then, you should modify your XSL file to handle <build> tags:
> stylesheet.xsl
> (part)--------------------------------------------------------
> ----------
> ----------
> 	<xsl:template
> match="builds"><xsl:apply-templates/></xsl:template>
> 	<xsl:template match="build"><xsl:apply-templates
> select="document(@file)"/></xsl:template>
> --------------------------------------------------------------
> ----------
> ---------------------------
>
> Run buildall.bat and voila!
>
> Regards,
> Alek Andreev
> alek@post.com
>
>
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of ronald
> heller
> Sent: Tuesday, January 29, 2002 11:00 AM
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] saxon in batch file for lots and lots of xml files
>
> Hi there,
>
> I have a large directory with rather small xml files. There
> may be well
> over 500 files in there.
> Once a day these files are transformed with saxon 6.2.
> Although this goes well, it takes a lot of time.
> I have a feeling that is is not the transformation itself that takes a
> lot
> of time, but that the starting and closing of saxon is.
> let me show you some code from the batchfiles:
>
> 1.bat:
> ---------------------------------------
> for %%b in ("*.xml") do call 2.bat %%b CC
> rem. for each xml file that is found I call 2.bat
>
>
> 2.bat
> ---------------------------------------
> java com.icl.saxon.StyleSheet -o "%1-a" "%1" "convert.xsl"
> rem for each file that has to be transformed saxon/java is started and
> closed.
>
> Is there a quicker/smarter way of doing this?
>
> any help is appreciated
>
> Regards,
>
> Ronald
>
> (ps I tried Instant saxon, but that gives more or less the
> same results)
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]