A sample add to cart xslt follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet 
	version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:msxml="urn:schemas-microsoft-com:xslt"
	xmlns:umbraco.library="urn:umbraco.library"
	xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"
	xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
	xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
	xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
	xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
	xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
	xmlns:procure="urn:procure" 
	exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets procure ">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>

<xsl:template match="/">
	<form action='/cart.aspx' method='post'>
	<xsl:variable name="productId" select="$currentPage/data[@alias='product']/text()"/>
	<xsl:variable name="product" select="procure:GetProduct($productId)"/>
	<xsl:value-of select="$product/name/text()"/>
	Type: <xsl:value-of select="$product/productType/name/text()"/><br/>
	<input type='hidden' name='{procure:GetAddToCartInputName($productId)}' value='{$productId}'/>
	Quantity: <input type='text' name='{procure:GetQuantityInputName($productId)}' value='1'/><br/>
	<input name='submit' type='submit' value='Add To Cart'/>
	</form>
</xsl:template>

</xsl:stylesheet>

Last edited Jan 18, 2010 at 2:18 PM by cyberknet, version 4

Comments

No comments yet.