<?xml version="1.0" encoding="windows-1252"?>
<node id="344368" title="Re: Just use an XSLT stylesheet" created="2004-04-12 08:38:00" updated="2005-07-06 17:08:46">
<type id="11">
note</type>
<author id="272239">
liz</author>
<data>
<field name="doctext">
&lt;I&gt;...and it lacks the wealth of modules that CPAN offers.&lt;/I&gt;
&lt;P&gt;
Please note that [cpan://XML::LibXSLT], the XSLT companion to [cpan://XML::LibXML] offers the "register_function" functionality which allows Perl functions to be called from stylesheets.  An example (directly from the XML::LibXSLT documentation):
&lt;code&gt;
 XML::LibXSLT-&gt;register_function("urn:foo", "bar", sub { scalar localtime });
&lt;/code&gt;
and then later in a XSLT stylesheet:
&lt;code&gt;
&lt;xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:foo="urn:foo"&gt;
  &lt;xsl:template match="/"&gt;
    The time is: &lt;xsl:value-of select="foo:bar()"/&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
&lt;/code&gt;
&lt;P&gt;
This implies that CPAN modules &lt;B&gt;can&lt;/B&gt; be made available at least in stylesheets using XML::LibXSLT.
&lt;P&gt;
I've used this approach for a client, who is now running about 40 syndicated websites out of a single database in production using this approach.  Even the associated CMS is using XML::LibXSLT with special custom functions for handling forms and updating the underlying database.
&lt;P&gt;
Typical modules that I've made available that way (directly or indirectly) are [cpan://DBI], [cpan://LWP::UserAgent], [cpan://POSIX], [cpan://Digest::MD5], [cpan://Email::Valid], [cpan://Time::ParseDate], etc. etc. etc.
&lt;P&gt;
Liz</field>
<field name="root_node">
344355</field>
<field name="parent_node">
344355</field>
</data>
</node>
