+
+sub calc_init_options {
+ my($xc) = @_;
+
+ my @ops;
+ my @nodes = $xc->findnodes('e:configInfo/e:supports/@type');
+ foreach my $node (@nodes) {
+ my $type = $node->value();
+ if ($type =~ s/^z3950_//) {
+ push @ops, $type;
+ }
+ }
+
+ return join(", ", @ops);
+}
+
+sub calc_ap {
+ my($xc, $set) = @_;
+
+ my $expr = 'e:indexInfo/e:index/e:map/e:attr[
+ @set = "'.$set.'" and @type = "1"]';
+ my @bib1nodes = $xc->findnodes($expr);
+ my $nbib1 = @bib1nodes;
+ return "[none]" if $nbib1 == 0;
+
+ my $res = "";
+ my($first, $last);
+ @bib1nodes = sort { $a->findvalue(".") <=> $b->findvalue(".") } @bib1nodes;
+ foreach my $node (@bib1nodes) {
+ my $ap .= $node->findvalue(".");
+ if (!defined $first) {
+ $first = $ap;
+ } elsif (!defined $last || $last == $ap-1) {
+ $last = $ap;
+ } else {
+ # Got a complete range
+ $res .= ", " if $res ne "";
+ $res .= "$first";
+ $res .= "-$last" if defined $last;
+ $first = $ap;
+ $last = undef;
+ }
+ }
+
+ # Leftovers
+ if (defined $first) {
+ $res .= ", " if $res ne "";
+ $res .= "$first";
+ $res .= "-$last" if defined $last;
+ }
+
+ return "$nbib1 access points: $res";
+}
+
+sub calc_boolean {
+ my($xc) = @_;
+
+ ### Note that we are currently interrogating an IRSpy extension.
+ # The standard ZeeRex record should be extended with a
+ # "supports" type for this.
+ my @nodes = $xc->findnodes('i:status/i:boolean[@ok = "1"]');
+ my $res = join(", ", map { $_->findvalue('@operator') } @nodes);
+ $res = "[none]" if $res eq "";
+ return $res;
+}
+
+sub calc_nrs {
+ my($xc) = @_;
+
+ my @nodes = $xc->findnodes('i:status/i:named_resultset[@ok = "1"]');
+ return @nodes ? "Yes" : "No";
+}
+
+sub calc_recsyn {
+ my($xc) = @_;
+
+ my @nodes = $xc->findnodes('e:recordInfo/e:recordSyntax');
+ my $res = join(", ", map { $_->findvalue('@name') } @nodes);
+ $res = "[none]" if $res eq "";
+ return $res;
+}
+
+sub calc_explain {
+ my($xc) = @_;
+
+ my @nodes = $xc->findnodes('i:status/i:explain[@ok = "1"]');
+ my $res = join(", ", map { $_->findvalue('@category') } @nodes);
+ $res = "[none]" if $res eq "";
+ return $res;
+}
+