First page Back Continue Last page Graphics
Dynamic XPath and Interpolators
ls .//article[@pubyear > 1999];
Can we create XPath dynamically in XSH?
$filter = “@pubyear > 1999”; # Think: $filter=$ARGV[1]
ls .//*[xsh:evaluate($filter,.)]; # as EXSLT dyn:evaluate
ls .//*[${filter}]; # Interpolator
Other interpolators (ls //scratch):
ls //${{ join 'c',qw(s rat h) }}; # Interpolate a Perl code
ls //${(concat("scra","tch"))}; # Interpolate XPath
ls //${(name(//scratch))}; # Huh?