[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
N Zhou,
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
Re: [xsl] XSLT processor and substring-after
Subject: Re: [xsl] XSLT processor and substring-after From: Cas Tuyn <Cas.Tuyn@xxxxxxxx> Date: Fri, 15 Apr 2005 09:30:41 +0200 |
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
use XML::LibXML; use XML::Sablotron;
$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);
-- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT processor and substr, James Fuller | Thread | [xsl] only two chars after a slash, henry human |
RE: [xsl] xsl, and different xml ve, Aron Bock | Date | Re: [xsl] Preventing tags from coll, Cas Tuyn |
Month |