NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Way too much work (Score:1)
You’re defining two identity copies, one on the root element and one for everything else; why? Next, you write a template for
//*which is equivalent to matching*(but I haven’t slept and it’s 6AM, so I might be making a mistake). And finally, you say making the D nodes sort together with all the others would be a lot of work, when actually it’s less work than you’re already doing. Overall:Re: (Score:1)
Re: (Score:1)
Re: (Score:1)
Re:Way too much work (Score:1)
Or use something more restrictive than
node()in the identity transform to avoid matching elements, eliminating the conflict in the first place. The types a node can have are element, text, comment and processing instruction. Matching any node except elements therefore translates to XPath as “text()|comment()|processing-instruction()”. Another, possibly better way to write that (certainly a shorter one) is “node()[not(self::*)]”. (The predicate “[]” constrains thenode()to match only when*wouldnot()match the current node of that step,self::.)Messing with priorities directly is often bad maintainability juju. If you have a lot of possible matches, conflicts resolution will be complex and will occasionally produce surprising interactions that can be hair-tearingly hard to fix. Reducing the number of candidate templates is almost always preferable over coercing the matcher into resolving to the right one.
Reply to This
Parent