UPDATED for Version 9...
HTML Code:
<?xml version="1.0" standalone="yes" ?>
<package version="2.1" displayname="BFGs canonical package" debug="false" includeentityhelper="false" allowengine="true">
<query name="Products" rowElementName="Product">
<sql>
<![CDATA[
SELECT ProductID, Name, SEName FROM Product WHERE ProductID = @ProductID
]]>
</sql>
<queryparam paramname="@ProductID" paramtype="request" requestparamname="ProductID" sqlDataType="int" defvalue="0" validationpattern="^\d{1,10}$" />
</query>
<query name="Categories" rowElementName="Category">
<sql>
<![CDATA[
SELECT CategoryID, Name, SEName FROM Category WHERE CategoryID = @CategoryID
]]>
</sql>
<queryparam paramname="@CategoryID" paramtype="request" requestparamname="CategoryID" sqlDataType="int" defvalue="0" validationpattern="^\d{1,10}$" />
</query>
<PackageTransform>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:param name="site">http://www.domain.co.uk/</xsl:param>
<xsl:param name="canonical">
<xsl:choose>
<xsl:when test="/root/Categories/Category/CategoryID > 0 and (/root/QueryString/pagenum > 1)"><xsl:value-of select="$site"/>c-<xsl:value-of select="/root/Categories/Category/CategoryID"/>-<xsl:value-of select="/root/Categories/Category/SEName"/>.aspx?pagenum=<xsl:value-of select="/root/QueryString/pagenum"/></xsl:when>
<xsl:when test="/root/Categories/Category/CategoryID > 0"><xsl:value-of select="$site"/>c-<xsl:value-of select="/root/Categories/Category/CategoryID"/>-<xsl:value-of select="/root/Categories/Category/SEName"/>.aspx</xsl:when>
<xsl:when test="/root/Products/Product/ProductID > 0"><xsl:value-of select="$site"/>p-<xsl:value-of select="/root/Products/Product/ProductID"/>-<xsl:value-of select="/root/Products/Product/SEName"/>.aspx</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:choose>
<xsl:when test="$canonical != 0">
<link rel="canonical" href="{$canonical}" />
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
</PackageTransform>
</package>
TTFN
BFG