namespace "http://www.w3.org/1999/xhtml";
namespace html = "http://www.w3.org/1999/xhtml";
namespace g="urn:x-mlmind:namespace:group";

for-each //p[matches(., "^\*+\s+")] {
    set-variable("label", substring-before(., " "));
    set-variable("bullets", count(tokenize($label, "\*")) - 1);
    message("label=&quot;", $label, "&quot;, bullets=", $bullets);

    delete-text("^\*+\s+");

    set-element-name("li");

    set-attribute("g:id", concat("bulleted", $bullets));
    set-attribute("g:container", "ul");
    set-attribute("g:nesting", $bullets);
}

group();
