| 
              ImagoX Counter Extension  
            The ImagoX Counter Extension is an implementation of a "hit
            counter". Counter can register hits, report hit totals, or both in a single request. Counter
            may be configured to use either a file-based or database-based datastore.   update element.Update the counter for the requested URI. Attributes: 
   read element.Read the counter for the requested URI. Attributes: 
  | 
    
| 
            
             The ImagoX Counter is a good candidate for the Launcher mechanism,
            otherwise it must create a new instance of the Counter class on each request. If a database-based
            approach is chosen any database supported by 
            LDBC may be used.  Additional
            ImagoX extension configuration information is available
            here.
            The following configuration lines go into the
            imago.properties file. Launcher-style configuration Other Launcher configuration examples are shown here. File-based counter: init.Launcher.class.Counter=org.xenei.imagoX.counter.ImagoCounterDatabase-based counter: init.Launcher.class.Counter=org.xenei.imagoX.counter.ImagoCounterimago.properties-style configuration File-based counter: org.xenei.imagoX.counter.ImagoCounter.class=org.xenei.imagoX.counter.FileCounterDataDatabase-based counter: init.Launcher.class.Counter=org.xenei.imagoX.counter.ImagoCounter Usage  
            Assuming that the XML file is as follows: 
            <?xml version="1.0"?> <document xmlns:imago="http://xenei.org/imago/2002" > <imago:counter/> </document> The method of counter usage depends upon the configuration style.
            If configured using the Launcher style the following XSL would list the count twice.
            The first one would update it and the second would simply display it. 
            <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:launcher="xalan://org.xenei.imago.extensions.Launcher" xmlns:imago="http://xenei.org/imago/2002" extension-element-prefixes="xcounter" > <xsl:template match="document"> <xsl:apply-templates /> </xsl:template> <xsl:template match="imago:counter"> <launcher:launch launcher:class="Counter" launcher:method="update" format="text" /> <launcher:launch launcher:class="Counter" launcher:method="read" format="text"/> </xsl:template> </xsl:stylesheet> An alternative to the XSLT above is the imago.properties style
            configuration.  Using the same XML file this transform will produce the same results.
            However it will take longer to execute. 
            <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xcounter="xalan://org.xenei.imagox.counter.ImagoCounter" xmlns:imago="http://xenei.org/imago/2002" extension-element-prefixes="xcounter" > <xsl:template match="document"> <xsl:apply-templates /> </xsl:template> <xsl:template match="imago:counter"> <xcounter:update format="text" /> <!-- update and display --> <xcounter:read format="text" /> <!-- display again --> </xsl:template> </xsl:stylesheet>  |