<?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?>
<!-- This stylesheet generates appropriate Windows batch files for different XSL engines -->
<!-- It has not been tested with multiple parameters or in every case. You will
   probably need to adjust all the paths to your machine's paths -->
<!-- Rick Jelliffe (C) 2001, free use granted under terms of zlib/libpng license -->
<!-- If you use this or upgrade it, please send changes to ricko@gate.sinica.edu.tw 
    or ricko@allette.com.au if that fails -->
<!-- To use this run it on an instance like

   <connections xmlns="http://www.ascc.net/xml/plugger">
	<function name="skelet~1" >
		<param name="xxx">zzz</param>
		<input file="aaaa.xml" />
		<output file="bbbb.xml" />
	</function>
  </connections>

You can of course specify lots of functions.  When invoking this, you
have to pass a command line parameter giving the XSLT engine you want to
ultimately use (this does not select the XSLT engine that transforms this
script: you have to select all that yourself.)

Note function name is used as the name (with .xsl suffixed) of the stylesheet.

Probably need to also put in how to select output mode (XML, Text, etc) and
a debug attribute.  But not in this one.

-->
<xsl:stylesheet version="1.0" xmlns:nex="http://www.ascc.net/xml/connect" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >
   <xsl:output method="text" />
   <xsl:param name="engine" value="XT" />
   
  <xsl:template match="nex:connections" xml:space="preserve">
@echo off
	<xsl:apply-templates />
  </xsl:template>
  
   <xsl:template match="nex:function" xsl:space="preserve"
	><xsl:choose ><xsl:when test="$engine='XT'" xml:space="preserve">
xt.exe <xsl:value-of select="nex:input/@file" 
	/>  <xsl:value-of select="@name" 
	/>.xsl   <xsl:value-of select="nex:output/@file" 
	/>   <xsl:for-each select="nex:param">  <xsl:value-of select="@name"/>=<xsl:value-of select="."
	/>   </xsl:for-each>
		</xsl:when
		><xsl:when test="$engine='SAXON'"  xml:space="preserve">
saxon.exe  -o <xsl:value-of select="nex:output/@file" 
	/> <xsl:value-of select="nex:input/@file" 
	/>  <xsl:value-of select="@name" 
	/>.xsl  <xsl:for-each select="nex:param"> <xsl:value-of select="@name"/>=<xsl:value-of select="."
	/>  </xsl:for-each>
		</xsl:when
		><xsl:when test="$engine='MSXML'" xml:space="preserve">
msxsl.exe <xsl:value-of select="nex:input/@file" 
	/>  <xsl:value-of select="@name" 
	/>.xsl  -o <xsl:value-of select="nex:output/@file" 
	/>  <xsl:for-each select="nex:param"> <xsl:value-of select="@name"/>='<xsl:value-of select="."
	/>'  </xsl:for-each> 			 
		</xsl:when
		><xsl:when test="$engine='Oracle4J'" xml:space="preserve">
java -cp d:\progra~1\oracle\schema~1\2_1_0_1\xmlparserv2.jar oracle.xml.parser.v2.oraxsl  <xsl:for-each select="param"> -p <xsl:value-of select="@name"/>=<xsl:value-of select="."
	/>  </xsl:for-each
	> <xsl:value-of select="nex:input/@file" 
	/>  <xsl:value-of select="@name" 
	/>.xsl  <xsl:value-of select="nex:output/@file" 
	/> 
		</xsl:when
		><xsl:when test="$engine='Xalan4J'" xml:space="preserve">
SET CLASSPATH=%classpath%;D:\Program Files\Xalan\xalan-j_2_0_0\bin\xalan.jar;D:\Program Files\Xalan\xalan-j_2_0_0\bin\xerces.jar;d:\progra~1\oracle~1\lib\xmlpar~1.jar;
java org.apache.xalan.xslt.Process  -IN <xsl:value-of select="nex:input/@file" 
	/> -XSL <xsl:value-of select="@name" 
	/>.xsl -OUT <xsl:value-of select="nex:output/@file" 
	/> -PARAM <xsl:for-each select="nex:param"> <xsl:value-of select="@name"/> <xsl:value-of select="."
	/>  </xsl:for-each>
		</xsl:when
		><xsl:when test="$engine='Xalan4C'" xml:space="preserve">
D:\Progra~1\Xalan\xml-xalan\c\Build\Win32\VC6\Release\TestXSLT.exe   -IN <xsl:value-of select="nex:input/@file" 
	/> -XSL <xsl:value-of select="@name" 
	/>.xsl -OUT <xsl:value-of select="nex:output/@file" 
	/> -PARAM <xsl:for-each select="nex:param"> <xsl:value-of select="@name"/> <xsl:value-of select="."
	/>  </xsl:for-each>
		</xsl:when>
		<xsl:when test="$engine='Sablotron'" xml:space="preserve">
sabcmd.exe  <xsl:value-of select="@name" 
	/>.xsl  <xsl:value-of select="nex:input/@file" 
	/>  <xsl:value-of select="nex:output/@file" 
	/>  <xsl:for-each select="nex:param"> <xsl:value-of select="@name"/>=<xsl:value-of select="."
	/>  </xsl:for-each>
		</xsl:when
		><xsl:when test="$engine='Unicorn'" xml:space="preserve">
uxt.exe  <xsl:value-of select="nex:input/@file" 
	/>  <xsl:value-of select="@name" 
	/>.xsl  <xsl:value-of select="nex:output/@file" 
	/>  <xsl:for-each select="nex:param"> /P<xsl:value-of select="@name"/>=<xsl:value-of select="."
	/>  </xsl:for-each>
		</xsl:when
		><xsl:when test="$engine='Infoteria'" xml:space="preserve">
iXSLT.exe -i:<xsl:value-of select="nex:input/@file" 
	/>  -s:<xsl:value-of select="@name" 
	/>.xsl  -o:<xsl:value-of select="nex:output/@file" 
	/>  <xsl:for-each select="nex:param"> -p:<xsl:value-of select="@name"/>=<xsl:value-of select="."
	/>  </xsl:for-each>	 
		</xsl:when
		><xsl:otherwise>
			<xsl:message>Unknown engine</xsl:message>
		</xsl:otherwise>
	</xsl:choose>
   </xsl:template>

  <xsl:template match="nex:input | nex:output | nex:param" />
<!--
   <xsl:template match="*"  priority="-1">
	<xsl:message>Error: unknown element <xsl:value-of select="name()" /></xsl:message>
   </xsl:template>
-->
</xsl:stylesheet>
