我需要给每个步骤编号以及它们自己的段落。我得到的最接近的数字仅显示了一个步骤,并且没有将数字与内容(即1个内容和其余步骤)分开。
这是我需要编号的相关XML部分:
<directions>
<step> Heat the oil in a casserole or large, wide pan and fry the lardons until
crisp.</step>
<step> Add the sliced leek and soften it with the lardons for a minute or so.</step>
<step> Cut chicken thighs into 2 or 3 pieces each, tip them into the pan with the bay
leaves, torn mushrooms and wine. </step>
<step>Season with salt and pepper to taste and bring to the boil, cover the pan and
simmer gently for 30-40 minutes, stirring in the double cream for the last couple of
minutes if you want. </step>
<note> Like all stews, this tastes its mellowest best if you let it get cold and then
reheat the next day. But it's no hardship to eat straight off. Whichever, serve
sprinkled with dill and together with some buttered noodles.</note>
</directions>
</recipe>
</recipeml>
这是我目前对XSLT的尝试:
</xsl:template>
<xsl:template match="recipeml/recipe/directions">
<h2>Method</h2>
<xsl:for-each select="directions/step">
<p><xsl:value-of select="."/>
<xsl:number format="1"/>
</p></xsl:for-each>
<p><xsl:value-of select="child::note"/></p>
</xsl:template>