<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method = "xml"
	            indent="no"
				xmlns="http://www.w3.org/1999/XML"
				omit-xml-declaration = "no"
	            encoding="ISO-8859-1"
				/>
<!--
	            doctype-public= "-//W3C//DTD XML 1.1//EN"
-->

	<xsl:template match = "/html-fragment">
		<html-fragment>
		<xsl:apply-templates>
			<xsl:with-param name = "eid" select = "@eid" />
			<xsl:with-param name = "cartlen" select = "@cartlen" />
		</xsl:apply-templates>
		</html-fragment>
	</xsl:template>

	<xsl:template match = "h2">
		<h2><xsl:value-of select = "."/></h2>
	</xsl:template>

	<xsl:template match = "p">
		<xsl:param name = "eid" />
		<xsl:param name = "cartlen" />
		<p>
			<xsl:apply-templates>
				<xsl:with-param name = "eid" />
				<xsl:with-param name = "cartlen" />
			</xsl:apply-templates>		
		</p>
	</xsl:template>

	<xsl:template match = "cart">
		<xsl:param name = "eid" />
		<xsl:param name = "cartlen" />
		<p><xsl:text>Your cart </xsl:text>
		<xsl:choose>
			<xsl:when test = "$cartlen = 0">
				contains nothing, so maybe you want to <a><xsl:attribute name="href">javascript:product_view('<xsl:value-of select = "$eid" />')</xsl:attribute>fill it up</a> with some stuff, or something.
			</xsl:when>
			<xsl:when test = "$cartlen > 0">
				contains some stuff, so you can either <a><xsl:attribute name="href">javascript:product_view('<xsl:value-of select = "$eid" />')</xsl:attribute>get more stuff</a>, <a href = "javascript:switch_config('demonstration_6:view_cart')">see what you picked</a>, or <a href = "javascript:switch_config('demonstration_6:checkout')">proceed to checkout</a>.
			</xsl:when>
			<xsl:otherwise><b>is a bad, broken down cart!</b> but you can try to <a><xsl:attribute name="href">javascript:product_view('<xsl:value-of select = "$eid" />')</xsl:attribute>fill it up</a> anyway.</xsl:otherwise>
		</xsl:choose>
		</p>
	</xsl:template>

</xsl:stylesheet>


