Child elements are getting duplicated and bunched together at the end
of each narrative-paragraph. What I need to fathom is how to gather
the processed children up in para.content and not loop and duplicate
them at the end.
Current code & output:
xm.css('narrative-paragraph').each do |para|
doc.p.npt(:id => para['number']) { doc.text para
['number'] }
doc.p.np { doc.text para.content
xm.css('narrative-paragraph narrative-xref').each
do |xref|
doc.a(:href => "#" + xref['number'])
{ doc.text xref['number'] }
end
xm.css('narrative-paragraph para-
text').each do |paratext|
doc.span.paratext { doc.text
paratext.content }
end
xm.css('narrative-paragraph legis-
cite').each do |legiscite|
doc.span.legiscite
{ doc.text legiscite.content }
end
}...
outputs...
<p class="npt" id="1.001">1.001</p>
<p class="np">
The
Legal Services Act 2007 has been enacted to establish a new Legal
Services Board as well as an Office for Legal Complaints and also
“to make provision for, and in connection with, the regulation
of persons who carry on certain legal activities”. A
Commencement No.1 and Transitory Provisions Order has been made (
SI 2008/222) bringi...
...Act set out the offences committed by persons carrying out
restricted legal activities without entitlement.
<a href="#1.005">1.005</a><a href="#1.003">1.003</a><a
href="#1.031">1.031</a><a href="#1.017">1.017</a><a
href="#1.016">1.016</a><a href="#29.001">29.001</a><a
href="#30.046">30.046</a><a href="#1.012">1.012</a><a
href="#25.070">25.070</a><a href="#1.011">1.011</a><a
href="#1.012">1.012</a><a href="#1.006">1.006</a><a
href="#1.004">1.004</a><a href="#1.018">1.018</a><a
href="#7.002">7.002</a><a href="#11.098">11.098</a><a
href="#18.011">18.011</a><a href="#18.016">18.016</a><a
href="#25.195">25.195</a><a href="#1.051">1.051</a><a
href="#8.025">8.025</a><a href="#11.059">11.059</a><a
href="#4.012">4.012</a><a href="#1.052">1.052</a><a
href="#1.031">1.031</a><span class="paratext">The
Legal Services Act 2007 has been enacted to establish a new Legal
Services Board as well as an Office for Legal Complaints and also
“to make provision for, and in connection with, the regulation
of persons who carry on certain legal activities”. A
Commencement No.1 and Transitory Provisions Order has been made (
SI 2008/222) bring...
...reserved legal activities:</span><span class="paratext">
the exercise of a right of audience;
the conduct of litigation;
reserved instrument activities;
probate activities;
notarial activities;
the administration of oaths.</span>