Thanks loads for everyone's help on this, it is all starting to make sense. However I'm still having a bit of trouble, (J�rg I read your posting on Apache::AxKit::Language::XSP::SimpleTaglib seeing as I am yet to get TaglibHelper to work would you recommend I give the new mod a try?)
I changed my taglib to show; $NS = 'http://www.mytest.com/xsp/taglib/'; Correspondingly I changed my xsp page, (taglib.xml), to reference the taglib as suggested; <?xml version="1.0"?> <?xml-stylesheet href="." type="application/x-xsp"?> <?xml-stylesheet href="taglib.xsl" type="text/xsl"?> <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core" xmlns:mylib="http://www.mytest.com/xsp/taglib/" language="Perl"> <greeting><mylib:hello key='alpha' /></greeting> </xsp:page> The taglib is within a directory on the Perl @INC path, inside the subdirectory /freeloader as such taglib.pm is defined; package freeloader::taglib; Lastly my httpd.conf references the tag lib with, (bit unsure about this bit); AxAddXSPTaglib freeloader::taglib When I try and view the page (taglib.xml), I get the following error in my error_log; [Fri Feb 22 11:12:49 2002] [notice] Apache/1.3.23 (Unix) AxKit/1.5 mod_perl/1.26 configured -- resuming normal operations [Fri Feb 22 11:12:49 2002] [notice] Accept mutex: fcntl (Default: fcntl) [Fri Feb 22 11:12:57 2002] [error] [client 192.168.11.3] [AxKit] [Error] Can't locate object method "register" via package "freeloader::taglib " (perhaps you forgot to load "freeloader::taglib"?) at /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/Apache/AxKit/Language/XSP. pm line 15 3. Obviously I've got some more reading to do on the mod_perl front!! But I assumed my taglib below was complete. -------------------------------taglib.pm # ######################################################################## #test-taglib # ######################################################################## #001 package freeloader::taglib; $NS = 'http://www.mytest.com/xsp/taglib/'; @EXPORT_TAGLIB = ( 'hello()' ); use Apache::AxKit::Language::XSP::TaglibHelper; sub parse_char { Apache::AxKit::Language::XSP::TaglibHelper::parse_char(@_); } sub parse_start { Apache::AxKit::Language::XSP::TaglibHelper::parse_start(@_); } sub parse_end { Apache::AxKit::Language::XSP::TaglibHelper::parse_end(@_); } use strict; sub hello() { return "hello world!"; } > On 02/21/02 08:02 AM, "Mark Cance" <[EMAIL PROTECTED]> wrote: >> I'm trying to knock together a taglib with AxKit::TaglibHelper, but there's >> a couple of things I'm real unsure on. > >> My main question is how do I reference the taglib from within my XML. If I >> remember from my limited knowledge of Cocoon a taglib is referenced by - >> <?xml-logicsheet href="http://www.mysite.com/mytaglib.xsl"?> I tried this >> with AxKit without any joy. > > The "$NS" variable must be set to the same value that you want to use as the > URL in your namespace declaration. For example, in your taglib Perl Module > set: > > $NS = "http://mysite.com/my/taglib"; > > Then, in your XSP page, you must reference that taglib with a namespace in > the "xsp:page" tag. For example, > > <?xml version="1.0"?> > <xsp:page > xmlns:xsp="http://www.apache.org/1999/XSP/Core" > xmlns:mylib="http://mysite.com/my/taglib" > language="Perl"> > <page> > <!-- this would call the function "my_function" in your new taglib > <mylib:my_function key='alpha' /> > </page> > </xsp:page> > > Again, just make certain that the "$NS" variable in your .PM file matches > the "xmlns" namespace value in your "<xsp:page>" tag. > >> My other question, (and probably the root of my problem), is what do I call >> the taglib in terms of type, (.xsl or .pm?), if its .pm I assume it has to >> be within a directory on my @INC path and referenced by the XML in a >> different way than I give above? > > Yes, the .PM file must be included in your @INC Path. Just include a > section at the top of your httpd.conf for your mod_perl server: > <perl> > use lib "/my/new/lib/path"; > </perl> > > Finally, make sure you don't forget to include the "AxAddXSPTaglib" > directive in your "httpd.conf". Without loading the taglib into AxKit there > is no way that the value of "$NS" can be looked up and the taglib can be > matched to the XSP page. > > Good Luck- > > -R > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
