|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSLT processor and substring-after
N Zhou,
Thank you very much! I think the path is correct, but my processor does not support XPath well. I'm usingXML::XSLT with a depedency on XML::Parser not on XPath. Do you know Perl XSLT module supporting XPath 1.0 or higher? I know Saxon but I prefer CGI script. I'm using LibXML and Sablotron. Below two code snippets to get you started. The first bit looks in the file via XPath and collects elements and attributes. The second one does a XSLT transformation. Warning: Sablotron does only do XSLT 1.0 and will not do 2.0 without a full rewrite according to a developer from Ginger Alliance. Advantage of XSLT 1.0 is that most of what you want has been solved by someone else already, so Google is your friend in searching this lists' archives. Regards, Cas
$parser = XML::LibXML->new(); # open parser for use later
$tree = $parser->parse_file("$file");
$root = $tree->getDocumentElement;
$ptitle = $root->find('title');
$status = $root->findvalue('@status'); my $sab = new XML::Sablotron();
$sab->RegHandler(0, { MHMakeCode => \&myMHMakeCode,
MHLog => \&myMHLog,
MHError => \&myMHError });
my $sit = new XML::Sablotron::Situation;
open (LOGHANDLE, ">>$sablolog") or die "Can't write to $sablolog: $!"; foreach my $procedure (@filestodo) {
my $output = "$buffer1/${procedure}.html";
open OUT, ">$output" or die "Couldn't write to $output: $!";
$sab->process($sit, "$template", "${procedure}.xml", 'arg:/result');
my $result = $sab->getResultArg('arg:/result');
print OUT "$result\n";
close(OUT) or die "Couldn't close $output: $!";
}
close(LOGHANDLE);
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








