sealed class NumberingListStyleCollection { //... private int maxlevelDepth = 0; //... public void BeginList(HtmlEnumerator en) { int prevAbsNumId = absNumId; // lookup for a predefined list style in the template collection String type = en.StyleAttributes["list-style-type"]; bool orderedList = en.CurrentTag.Equals("
    ", StringComparison.OrdinalIgnoreCase); if (type == null || !knonwAbsNumIds.TryGetValue(type.ToLowerInvariant(), out absNumId)) { if (orderedList) absNumId = knonwAbsNumIds["decimal"]; else absNumId = knonwAbsNumIds["disc"]; } firstItem = true; levelDepth++; // save a NumberingInstance if the nested list style is the same as its ancestor. // this allows us to nest
      and restart the indentation to 1. int currentInstanceId = this.InstanceID; if (levelDepth > 1 && absNumId == prevAbsNumId && orderedList) { EnsureMultilevel(absNumId); } else { // For unordered lists (