Re: XSLT processing
Jakub Jezek <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
Ok, I'll try. First, I want to ask, if I overwrited my code into "libxslt form" good? My code: ======================================== use strict; use warnings; use diagnostics; use XML::LibXSLT; use XML::LibXML; # the arguments for this command are stylesheet and source files my $style_file = "test/test4.xsl"; my $source_file = "com.redhat.rhsa-20091463.xml"; # initialize the parser and XSLT processor my $parser = XML::LibXML->new(); my $xslt = XML::LibXSLT->new(); my $stylesheet = $xslt->parse_stylesheet_file($style_file); # for each source file: parse, transform, print out result my $source_doc = $parser->parse_file($source_file); my $result = $stylesheet->transform($source_doc); my $result2 = $stylesheet->output_string($result); print $result2; ======================================== After that I'll try to desribe, what I need to do with my xmls. I need to save tree structure of test, which are in <criterion> elements. This tree structure has logical structure, which is given by atribute @operator in elements <criteria>. And I am saving this data into DB. Examples are below: XMLs: http://forstman.kvalitne.cz/temp/jezza/com.redhat.rhsa-20091463.xml http://forstman.kvalitne.cz/temp/jezza/com.redhat.rhsa-20091490.xml My dreamy output :) (DB's tables) : http://forstman.kvalitne.cz/temp/jezza/nastrel_db_oval.pdf There are 2 tables, In criterias, I want to save just criteria groups with their operator. In critrions, I need to save groups of tests, which are in criteria. Each group of test is conected with a criteria. I hope it's understandable. THX J. J. Tod Harter wrote: > > Looks like the problem is not in the Perl script but rather in the > XSLT. You should ask somewhere where XSLT is discussed. > > > I agree, and I also heartily second dumping XML::XSLT for > XML::LibXSLT, its MANY times faster and a better implementation in all > respects. > > That being said the problem may be with namespaces? It is a bit hard > to follow with all the large amount of XML in your message, but I > don't see where anything defines a default namespace for your XPath > statements doing the matching in the root template. You have an NS > mapped to the prefix ns1 but your APPLY-TEMPLATES never refers to it > or any other prefix. > > > Or get rid of > that messy, unreadable, undecipherable, undebuggable, everything- > looks-exactly-the-same, overly-talkative nonsense and do the job > using something sane. > > > XSLT is the right tool for the job. Nobody makes you use it if you > don't like it, but this list is here to help people with problems, not > get on their case because they don't use your favorite tool. At least > suggest something else if you know something better. Personally I have > no problem reading XSLT and when its appropriate its orders of > magnitude better than the alternatives. > > -- > The Wise adapts himself to the world. The Fool adapts the world to > himself. Therefore, all progress depends on the Fool. > ------------------------------------------------------------------------ > > _______________________________________________ > Perl-XML mailing list > [email protected] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs