469,580 Members | 1,888 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,580 developers. It's quick & easy.

Cannot find the script or external object that implements prefix 'counter'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan"
  3.  xmlns:lxslt="http://xml.apache.org/xslt" xmlns:counter="ext1"  extension-element-prefixes="counter">
  4.  
  5.   <xsl:output method="html" version="1.0" encoding="utf-8" indent="yes"/>
  6.   <lxslt:component prefix="counter" functions="count">
  7.     <lxslt:script lang="Javascript">
  8.       var i = 1;
  9.       function count()
  10.       {
  11.       i=i+1;
  12.       return i;
  13.       }
  14.     </lxslt:script>
  15.   </lxslt:component>
  16.   <xsl:template match="/">
  17.     <html>
  18.       <head>
  19.  
  20.       </head>
  21.       <body>
  22.        <xsl:value-of select="counter:count()" />
  23.        <!--<xsl:apply-templates/>-->
  24.      </body>
  25.   </html>
  26.   </xsl:template>
  27.  
  28.  
  29.  
  30.   <xsl:template name="tar" match="TARGETCATEGORY">
  31.       <table border="2" BorderColor="#DEBA84" height="50px"  Width="436px" layout="fixed">
  32.       <tr><td colspan="2">
  33.          <a href="#{@Name}"><xsl:value-of select="@Name"/></a>   
  34.       </td></tr>
  35.     </table>
  36.     <xsl:variable name="node1" select="@Name"></xsl:variable>
  37.        <xsl:apply-templates/>
  38.  </xsl:template>
  39.  
  40.  
  41.  
  42.  
  43.  
  44.   <xsl:template match="SUBCATEGORY">
  45.     <xsl:value-of select="counter:count()" />
  46.  
  47.     <table border="2" BorderColor="#DEBA84" Width="436px" layout="fixed">
  48.          <tr><td colspan="2">
  49.               <a href="#{@Name}"><xsl:value-of select="@Name"/></a>
  50.              <a name="Top"></a>
  51.           </td></tr>
  52.     </table>
  53.       </xsl:template>
  54.    </xsl:stylesheet> 
Thanks in advance.


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Feb 18 '08 #1
3 7489
kenobewan
4,871 Expert 4TB
This article may help:
XSLT - On the Client
Feb 18 '08 #2
This article may help:
XSLT - On the Client
hi
i am still unable to remove that error.
Actually i want to retrive that return value of javascript funtion in my Template present in the same file.

thanks
Feb 19 '08 #3
This article may help:
XSLT - On the Client

I am using XSLT transformation to display XML file in ASP.NET 2.0 and I want to make A table of content similar as in the page of following link given .
....LINK....


My Code of xslt page is :

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
  4.   <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  5.  
  6.   <xsl:template match="/">
  7.     <html>
  8.  
  9.     <body>
  10.  
  11.       <xsl:apply-templates/>
  12.     </body>
  13.   </html>
  14. </xsl:template>
  15.  
  16. <xsl:template match="TARGETCATEGORY">
  17.       <table border="2" BorderColor="#DEBA84" height="50px"  Width="436px" layout="fixed">
  18.       <tr><td colspan="2">
  19.          <a href="#{@Name}"><xsl:value-of select="@Name"/></a>
  20.           <xsl:variable name="node1">
  21.           <xsl:value-of select="@Name"/>
  22.           </xsl:variable>    
  23.       </td></tr>
  24.     </table>
  25.        <xsl:apply-templates/>
  26.  </xsl:template>
  27.  
  28. <xsl:template name="sub" match="SUBCATEGORY">
  29. <table border="2" BorderColor="#DEBA84" Width="436px" layout="fixed">
  30.          <tr><td colspan="2">
  31.               <a href="@Name" onClick="count(i=i+1); return;"><xsl:value-of select="@Name"/></a>
  32.              <a name="Top"></a>
  33.           </td></tr>
  34.     </table>
  35.  
  36.       </xsl:template>
  37.    </xsl:stylesheet> 


I want to assign a number to each anchor tag dynamically.

Please help me.......!!!!!!!!!!!!!!!!!!!!
thanks in advance.
Feb 20 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by cjl | last post: by
7 posts views Thread by =?Utf-8?B?Um9iIFRob21zb24=?= | last post: by
2 posts views Thread by karinmorena | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.