5 $parser = new XML
::LibXML
;
8 foreach $file (readdir(DIR
)) {
9 if ($file !~ /([\d\.]+)\.xml/) { next; }
12 $xml = $parser->parse_file("$sec.xml");
13 $titles{$sec} = $xml->findvalue('/clause/@title');
15 if ($sec =~ /^([\d\.]+)\.(\d+)$/) {
23 $sections{$parent}[$sub-1] = $sec;
27 $doc = new XML
::LibXML
::Document
;
28 $toc = $doc->createElement('toc');
29 $doc->setDocumentElement($toc);
31 AddChildren
($toc, '');
33 print $doc->toString(1);
36 my $x = $sections{$_[1]};
39 my $n = $doc->createElement('node');
40 $n->setAttribute('number', $s);
41 $n->setAttribute('name', $titles{$s});
42 $_[0]->appendChild($n);