the error message
'error message undefined template'
is telling you that the XSLT processor does not support this EXSLT
function natively, either
a) choose an XSLT Processor that natively supports this EXSLT function
(saxon and xalan do)
or
b) import the native XSLT implementation found at
http://www.exslt.org/set/functions/distinct/set.distinct.template.xsl
hth, Jim Fuller
On 4/17/07, Vandna Sharma <sharmav(_at_)excelergy(_dot_)com> wrote:
> Hi all I am very new to XSLT programming,
> I am trying to do, "Grouping using the set:Distinct template from EXSLT". I
am having problem when I try to debug the xml file, I am getting error message undefined
template. I am using XMLspy version 5 rel.4. Below is the xml file, and xsl.
>
XSL file
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:set="http://exslt.org/set"
version="1.0" extension-element-prefixes="set" set:doc="http://www.exslt.org/set">
> <xsl:output encoding="utf-8" method="html" />
> <xsl:include href="style1.xsl"/>
>
> <!-- The essence of using the variable instead is very similar to a
key table. In
> this solution, all products are put into the variable (which itself is in
document order):-->
> <xsl:variable name="AllProducts" select="/"/>
>
> <!-- The variable $AllRegions will be initialized with all of the
distinct
> region elements. This collection of nodes is created using the
> set:distinct extension function from EXSLT.org (see bottom) -->
> <xsl:variable name="AllRegionsDistinct">
> <xsl:call-template name="set:distinct">
> <xsl:with-param name="nodes" select="//products/product/region"
/>
> </xsl:call-template>
> </xsl:variable>
> <xsl:variable name="AllRegions" select="$AllRegionsDistinct"/>
>
>
> <!-- Template for root rule -->
> <xsl:template match="/">
> <xsl:call-template name="Style1"/>
> <h2>Grouping of Products by Region, then by Product Name </h2>
> <xsl:apply-templates />
> </xsl:template>
>
> <!-- Template for products rule -->
> <xsl:template match="products">
>
> <!-- Iterate through the variable containing all of the unique
regions -->
> <xsl:for-each select="$AllRegions/region">
> <xsl:variable name="region" select="." /><BR></BR>
>
> <H3>Region: <xsl:value-of select="$region" /></H3>
>
> <table border="1">
> <tr>
> <th>Product ID</th>
> <th>Name</th>
> <th>Price</th>
> <th>Quantity</th>
> <th>Region</th>
> </tr>
>
> <!-- Grab the product elements that match the current
retion. At this point
> the products are retrived from our variable rather
than the document itself-->
> <xsl:for-each
select="$AllProducts/products/product[region=$region]">
> <xsl:sort select="name"/>
> <tr>
> <td><xsl:value-of select="prodid" /></td>
> <td><xsl:value-of select="name" /></td>
> <td><xsl:value-of select="price" /></td>
> <td><xsl:value-of select="quantity" /></td>
> <td><xsl:value-of select="region" /></td>
>
> </tr>
> </xsl:for-each>
> </table>
> </xsl:for-each>
> </xsl:template>
>
> <xsl:template name="set:distinct">
> <xsl:param name="nodes" select="/.." />
>
> <xsl:choose>
> <xsl:when test="not($nodes)" />
>
> <xsl:otherwise>
> <xsl:copy-of select="$nodes[1][not(. = $nodes[position() >
1])]" />
>
> <xsl:call-template name="set:distinct">
> <xsl:with-param name="nodes" select="$nodes[position() >
1]" />
> </xsl:call-template>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
> </xsl:stylesheet>
>
>
>
>
>
> XML file
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <products>
> <product>
> <prodid>V123049</prodid>
> <name>Screen-Top Monitor Shelf</name>
> <price>$59</price>
> <quantity>30</quantity>
> <region>NorthWest</region>
> </product>
> <product>
> <prodid>V392039</prodid>
> <name>Womens Bracelet Watch</name>
> <price>$175</price>
> <quantity>335</quantity>
> <region>SouthWest</region>
> </product>
> <product>
> <prodid>L930389</prodid>
> <name>Tobshiba Portable DVD Player</name>
> <price>$1,299</price>
> <quantity> >30</quantity>
> <region>NorthWest</region>
> </product>
> </products>
>
>
>
>
>
> Thanks
> Vandna
>
>
>
>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--