Home
XSLT Processor
Website Editor
CGI XSLT Processor
The style and source
Global parameters
Stylesheets
Stylesheet elements
Functions
Files upload
Details
Characters model
Data types
Result tree fragments
Variables scope
Conflict resolution
The key function
The document function
Curly brackets in attributes
Extensions
Extension modules
XSL message handlers
XML tree class
Sending messages to programs with XSLT prosessor

The xsl message handler is a package that opens a channel for the XSLT processor output.
package MyMessage::Send;
use strict;

sub message_handler {
my ($msg,$params)=@_;

open my $fh, "|/usr/lib/sendmail -oi -t" or die "could not open";

#print some headers

#print message
$msg->print_html($fh);#or print_xml or print_text
#html, xml or text state for the print method of XSLT

# or use the print method of XSL stylesheet
XSLT::printResultTree($fh,$msg);

#get text data of $msg XML tree
$msgstr=$msg->string();
close($fh); 
}
1;
The stylesheet can now use the xsl:message element to send the message.
<xsl:message msg-handler="MyMessage::Send" To="Destination &lt;{xpath expression}&gt;"
From="User Mail &lt;me@host&gt;"
Subject="subject line">

template for $msg

</xsl:message>
The variable $params is a reference to hash of xsl:message attributes. The attribute values are first evaluated by the XSLT processor as attribute templates except values of msg-handler and terminate.
Copyright © 2004 www.dopscripts.com