Regarding the first part of your question, it is important to understand that you can sometimes use different Open XML markup to achieve the same effect. Just because Microsoft Word produces markup in a certain way does not mean your way is incorrect, as long as your way is compliant with the standard.
Enhancing my original answer, here's an example of how you would restart numbering without duplicating the w:abstractNum
element, using roughly the text provided in the question:
Unnumbered text before first list.
1. Item 1
2. Item 2
Unnumbered text before second list.
1. Item 3 (restarted)
2. Item 4
Let's look at the corresponding main document part (document.xml
), noting that I've simplified the markup created by Microsoft Word:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:p>
<w:r>
<w:t>Unnumbered text before first list.</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="ListParagraph"/>
<w:numPr>
<w:ilvl w:val="0"/>
<w:numId w:val="1"/>
</w:numPr>
</w:pPr>
<w:r>
<w:t>Item 1</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="ListParagraph"/>
<w:numPr>
<w:ilvl w:val="0"/>
<w:numId w:val="1"/>
</w:numPr>
</w:pPr>
<w:r>
<w:t>Item 2</w:t>
</w:r>
</w:p>
<w:p>
<w:r>
<w:t>Unnumbered text before second list.</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="ListParagraph"/>
<w:numPr>
<w:ilvl w:val="0"/>
<w:numId w:val="2"/>
</w:numPr>
</w:pPr>
<w:r>
<w:t>Item 3 (restarted)</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="ListParagraph"/>
<w:numPr>
<w:ilvl w:val="0"/>
<w:numId w:val="2"/>
</w:numPr>
</w:pPr>
<w:r>
<w:t>Item 4</w:t>
</w:r>
</w:p>
</w:body>
</w:document>
You will note that the two lists are referencing two numbering ids (1 and 2) in their w:numId
elements.
Next, here is the corresponding numbering definitions part (numbering.xml
):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:numbering xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="w15">
<!-- This is the only w:abstractNum element in numbering.xml -->
<w:abstractNum w:abstractNumId="0" w15:restartNumberingAfterBreak="0">
<w:nsid w:val="23B5103A"/>
<w:multiLevelType w:val="hybridMultilevel"/>
<w:tmpl w:val="40963B22"/>
<!-- The following w:lvl is referenced by w:ilvl with w:val="0" -->
<w:lvl w:ilvl="0" w:tplc="0409000F">
<w:start w:val="1"/>
<w:numFmt w:val="decimal"/>
<w:lvlText w:val="%1."/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:ind w:left="720" w:hanging="360"/>
</w:pPr>
</w:lvl>
<!-- Markup for numbering levels 1-7 removed -->
<w:lvl w:ilvl="8" w:tplc="0409001B" w:tentative="1">
<!-- Child elements removed -->
</w:lvl>
</w:abstractNum>
<!-- The following w:num is referenced by the w:numId with w:val="1" -->
<w:num w:numId="1">
<w:abstractNumId w:val="0"/>
</w:num>
<!-- The following w:num is referenced by the w:numId with w:val="2" -->
<w:num w:numId="2">
<w:abstractNumId w:val="0"/>
<!-- The w:lvlOverride with its w:startOverride child restarts numbering -->
<w:lvlOverride w:ilvl="0">
<w:startOverride w:val="1"/>
</w:lvlOverride>
<!-- You can also override levels 1 to 8 in the same way, if required -->
</w:num>
</w:numbering>
You can see that this uses only one w:abstractNum
that is referenced by two `w:num' elements, one of which overrides the at least one level by restarting the numbering.
Regarding the second part of your question, if you want to mimic the behavior of Microsoft Word, the value of the w:nsid
element (Abstract Numbering Definition Identifier) is simply a unique number stated as a long hex number. The standard is silent about how exactly it should be created. So, for example, you can take pretty much any number that is not yet used by any w:abstractNum
element.
AbstractNum
, which I couldn't find other than duplicating anotherAbstractNum
andNumberingInstance
. It continues the numbering when I try to use sameAbstractNum
with differentNumberingInstance
– Ragwort