On Sat, Jul 11, 2009 at 07:40:05PM +0200, Nick Wellnhofer wrote: > > I have always used match="@*" which works as expected. > > But, being curious, I had a deeper look at xsltCompileStepPattern. The > problem is that "@node()", "attribute::node()", "child::node()" and "node()" > are all handled in different code paths and only the latter works. > > Then, I noticed that the handling of match="child::name" is wrong. It matches > the parents of <name> elements although it should be treated exactly like > match="name". So the whole XSLT_OP_CHILD stuff is unneeded. > > I also found that xsltScanName behaves a bit strange with regard to ':' > characters. It doesn't parse an XML Name like the documentation says. It's > better to use xsltScanNCName instead. > > Another minor issue is that the parser currently allows invalid expressions > like match="element*" because of lines 1745-1747 in pattern.c in trunk. > > Attached is a patch against trunk that fixes all these issues. It merges the > parsing of NodeTests in StepPatterns into a single code path keeping track of > the axis that has been specified previously. The patch also contains some > test cases.
Good analysis and excellent patch ! This does clean things up a lot ! Aplied and pushed to git head. The only change I had to make was to add the new regression tests in tests/REC/Makefile.am :-) Thanks a lot ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ [email protected] | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ _______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ [email protected] http://mail.gnome.org/mailman/listinfo/xslt
