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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abhinavnaresh
    New Member
    • Feb 2008
    • 11

    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:

    Code:
    <?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>
    Thanks in advance.


    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.507 27.42; ASP.NET Version:2.0.507 27.42
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    This article may help:
    XSLT - On the Client

    Comment

    • Abhinavnaresh
      New Member
      • Feb 2008
      • 11

      #3
      Originally posted by kenobewan
      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

      Comment

      • Abhinavnaresh
        New Member
        • Feb 2008
        • 11

        #4
        Originally posted by kenobewan
        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 :

        Code:
        <?xml version="1.0" encoding="utf-8"?>
        
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
          <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
        
          <xsl:template match="/">
            <html>
              
            <body>
              
              <xsl:apply-templates/>
            </body>
          </html>
        </xsl:template>
        
        <xsl:template 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>
                  <xsl:variable name="node1">
                  <xsl:value-of select="@Name"/>
                  </xsl:variable>    
              </td></tr>
            </table>
               <xsl:apply-templates/>
         </xsl:template>
        
        <xsl:template name="sub" match="SUBCATEGORY">
        <table border="2" BorderColor="#DEBA84" Width="436px" layout="fixed">
                 <tr><td colspan="2">
                      <a href="@Name" onClick="count(i=i+1); return;"><xsl:value-of select="@Name"/></a>
                     <a name="Top"></a>
                  </td></tr>
            </table>
            
              </xsl:template>
           </xsl:stylesheet>


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

        Please help me.......!!!!!! !!!!!!!!!!!!!!
        thanks in advance.

        Comment

        Working...