<?xml version="1.0" encoding="ISO-8859-1"?>
<txs:scriptsheet xmlns="http://www.w3.org/1999/xhtml" xmlns:txs="http://sourceforge.net/projects/txs" xmlns:req="http://www.agencexml.com/requests" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="0.4">
	<xsl:stylesheet version="1.0" txs:name="main" xmlns:req="http://www.agencexml.com/requests">
		<xsl:template match="/">
			<xsl:variable name="f" select="concat(substring-before(/req:params/req:exec,'xforms.txs'),/req:params/req:file)"/>
			<xsl:variable name="sheet">
				<xsl:choose>
					<xsl:when test="/req:params/req:engine = 'mozilla'">mozilla</xsl:when>
					<xsl:when test="/req:params/req:engine = 'ubiquity'">ubiquity</xsl:when>
					<xsl:otherwise>xsltforms</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>
			<txs:transform stylesheet="#{$sheet}">
				<txs:load filename="{$f}" format="xml"/>
			</txs:transform>
		</xsl:template>
	</xsl:stylesheet>
	<xsl:stylesheet txs:name="xsltforms" version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:txs="http://sourceforge.net/projects/txs" xmlns:req="http://www.agencexml.com/requests">
		<xsl:template match="/">
			<txs:return contenttype="text/xml" xmlns:my="http://commerce.example.com/payment">
				<txs:processing-instruction name="xml-stylesheet">type="text/xsl" href="/xforms-tests/xsltforms/xsltforms.xsl"</txs:processing-instruction>
				<xsl:apply-templates />
			</txs:return>
		</xsl:template>
		<xsl:template match="@action[.='http://xformstest.org/cgi-bin/echo.sh']" priority="1">
			<xsl:attribute name="action">http://www.agencexml.com/xforms-tests/xsltforms/echo.php</xsl:attribute>
		</xsl:template>
		<xsl:template match="@* | node()" priority="0">
			<xsl:copy>
				<xsl:apply-templates select="@* | node()"/>
			</xsl:copy>
		</xsl:template>
	</xsl:stylesheet>
	<xsl:stylesheet txs:name="mozilla" version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:txs="http://sourceforge.net/projects/txs" xmlns:req="http://www.agencexml.com/requests">
		<xsl:template match="/">
			<txs:return contenttype="application/xhtml+xml">
				<xsl:apply-templates />
			</txs:return>
		</xsl:template>
		<xsl:template match="@* | *">
			<xsl:copy>
				<xsl:apply-templates select="@* | node()"/>
			</xsl:copy>
		</xsl:template>
	</xsl:stylesheet>
	<xsl:stylesheet txs:name="ubiquity" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms">
		<xsl:template match="/">
			<txs:return contenttype="text/html">
				<xsl:apply-templates />
			</txs:return>
		</xsl:template>
		<xsl:template match="*" priority="0">    
      <xsl:copy>
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates/>
      </xsl:copy>
    </xsl:template>
    <xsl:template match="xhtml:head" priority="1">
			<xsl:copy>
				<xsl:copy-of select="@*"/>
				<xsl:apply-templates /> 
			</xsl:copy>
		</xsl:template>
		<xsl:template match="xhtml:body" priority="1">
			<xsl:copy>
				<xsl:copy-of select="@*|//xhtml:head/xforms:model" />
				<xsl:apply-templates />
			</xsl:copy>
		</xsl:template>
		<xsl:template match="xhtml:link" priority="1">
			<xhtml:script type="text/javascript" src="http://ubiquity-xforms.googlecode.com/svn/trunk/src/ubiquity-loader.js">/**/</xhtml:script>                     
			<xsl:copy>
				<xsl:copy-of select="@*" />
				<xsl:apply-templates />
			</xsl:copy>             
		</xsl:template> 
		<xsl:template match="xhtml:head/xforms:model" priority="1"/>
	</xsl:stylesheet>
</txs:scriptsheet>
