diff options
Diffstat (limited to 'lib/Tree/Transform/XSLTish/Optimizer.pod')
-rw-r--r-- | lib/Tree/Transform/XSLTish/Optimizer.pod | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/lib/Tree/Transform/XSLTish/Optimizer.pod b/lib/Tree/Transform/XSLTish/Optimizer.pod index ce855d5..e721e72 100644 --- a/lib/Tree/Transform/XSLTish/Optimizer.pod +++ b/lib/Tree/Transform/XSLTish/Optimizer.pod @@ -1,4 +1,6 @@ -C</> is in fact C</child:> (so C</whatever:foo> does not count) +=head1 random notes + +C</> is in fact C</child::> (so C</whatever::foo> does not count) C<//> can also be C<descendants(-or-self)?> (check that option) C<..> can also be C<parent> @@ -11,3 +13,57 @@ path contains C</> but no C<//>, apply only at C<count('/') - count('..')> upwar path contains C</> but no C<..>, start at C<count('/') - count('..')> upwards (ok, C<//> counts as 1 C</>) and go up to root what about C<ancestors(-or-self)?> ?? + + +-------- + +an optimizer takes a match rule and adds three slots: + +=over 4 + +=item C<opt_pattern> + +a pattern to use instead of the C<match> one + +=item C<expected_result> + +enum, specifying what the pattern (either C<match> or C<opt_pattern>) +should return for this rule to be considered matching: + +=over 8 + +=item C<this> + +the node we are applying the rule to + +=item C<any> + +any node + +=back + +=item C<min_depth> + +the minimum depth (on the C<ancestor-or-self::> axis) to test; 0 (or +C<undef>) means start at the current node, 1 means start at its +parent, and so on + +=item C<max_depth> + +the maximum depth (on the C<ancestor-or-self::> axis) to test; +C<undef> means "unlimited", i.e. stop only at the document root + +=back + +So: + +C<< match => 'foo' >> or C<< match => '//foo' >> would produce C<< +opt_pattern => 'self::foo', min_depth => 0, max_depth => 0 >> + +C<< match => 'foo/bar' >> or C<< match => '//foo/bar' >> would produce +C<< opt_pattern => 'self::bar/parent::foo', min_depth => 0, max_depth +=> 0 >> + +--------- + +we need a proper structure matcher! |