好的,我知道已经提出并回答了对此的各种变化; 我整天都在读它们,但我仍然被卡住了.所以,这里是:
我需要从一些XML创建HTML的摘要列表.
鉴于此XML:
<Root><!-- yes, I know I don't need a 'Root' element! Legacy code... -->
<Plans>
<Plan AreaID="1" UnitID="83">
<Part ID="9122" Name="foo" />
<Part ID="9126" Name="bar" />
</Plan>
<Plan AreaID="1" UnitID="86">
<Part ID="8650" Name="baz" />
</Plan>
<Plan AreaID="2" UnitID="26">
<Part ID="215" Name="quux" />
</Plan>
<Plan AreaID="1" UnitID="95">
<Part ID="7350" Name="meh" />
</Plan>
</Plans>
</Root>
Run Code Online (Sandbox Code Playgroud)
我需要发出:
<ol>
<li>Area 1:
<ol><!-- units in Area 1 -->
<li>Unit 83:
<ol>
<li>Part 9122 (foo)</li>
<li>Part 9126 (bar)</li>
</ol>
</li>
<li>Unit 86:
<ol> …Run Code Online (Sandbox Code Playgroud)