So this would be a sample XML file
<body>
<text>
<p xml:id="l-01">line 1</p>
<p>line 2</p>
<p>line 3</p>
<p>line 4</p>
</text>
</body>
So what I'd be interested in is an XSLT file that looks at all <p> elements, checks to see if an @xml:id exists, if one doesn't, to add and generate one.
So the transformed XML file would look like below, but with the understanding the @xml:id might be another generated ID (so as to keep things simple).
<body>
<text>
<p xml:id="l-01">line 1</p>
<p xml:id="l-02">line 2</p>
<p xml:id="l-03">line 3</p>
<p xml:id="l-04">line 4</p>
</text>
</body>