import xmlpl.xml; import xmlpl.string; import xmlpl.curl; node[] eval(element e); node[] eval(element e, integer §ion); integer sectionDepth = 1; node[] doSection(element section, string idx); node[] doSubsections(element section, string idx) { if (idx != "") idx = idx + "."; integer count = 1; foreach(section/*) switch(name(.)) { case "section": { doSection(., idx + (string)count++); break; } default: eval(.); } } node[] doSection(element section, string idx) { if (section/@disabled == "true") return; sectionDepth++; string header = "h" + sectionDepth; <(header)> idx; if (idx != "") ") "; value(section/@name); > doSubsections(section, idx); sectionDepth --; } node[] doSection(element section) { doSection(section, 1); } node[] doSectionContents(element section) { if (section/@disabled == "true") return;
e/node();