First page Back Continue Last page Graphics
Shared variable space
$c = string((//chapter)[1]/title); # a string
$x = count(//chapter[title=$c]); # a number
echo {“Found $x chapter”.(“s” x ($x!=1)).” named '$c'”};
Prints e.g.: Found 2 chapters named 'Introduction'
$titles = //chapter/title; # a node set
ls $titles[starts-with(.,”O”)];
echo { join “, “ @$titles };
Prints e.g.: Introduction, Terminology, What's XML, ...