Exception Details: System.Xml.Xsl.XsltException: Cannot find the script or external object that implements prefix 'counter'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
I am using XSLT transformation to display XML file in ASP.NET 2.0 and to pass the value inbetween the page i am using javascript.Any help is appreciated.
My XSLT code is:
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="utf-8"?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan"
- xmlns:lxslt="http://xml.apache.org/xslt" xmlns:counter="ext1" extension-element-prefixes="counter">
- <xsl:output method="html" version="1.0" encoding="utf-8" indent="yes"/>
- <lxslt:component prefix="counter" functions="count">
- <lxslt:script lang="Javascript">
- var i = 1;
- function count()
- {
- i=i+1;
- return i;
- }
- </lxslt:script>
- </lxslt:component>
- <xsl:template match="/">
- <html>
- <head>
- </head>
- <body>
- <xsl:value-of select="counter:count()" />
- <!--<xsl:apply-templates/>-->
- </body>
- </html>
- </xsl:template>
- <xsl:template name="tar" match="TARGETCATEGORY">
- <table border="2" BorderColor="#DEBA84" height="50px" Width="436px" layout="fixed">
- <tr><td colspan="2">
- <a href="#{@Name}"><xsl:value-of select="@Name"/></a>
- </td></tr>
- </table>
- <xsl:variable name="node1" select="@Name"></xsl:variable>
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="SUBCATEGORY">
- <xsl:value-of select="counter:count()" />
- <table border="2" BorderColor="#DEBA84" Width="436px" layout="fixed">
- <tr><td colspan="2">
- <a href="#{@Name}"><xsl:value-of select="@Name"/></a>
- <a name="Top"></a>
- </td></tr>
- </table>
- </xsl:template>
- </xsl:stylesheet>
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42