les gars, je pense que cela est une question délicate ...Comment créer une liste html à partir du fichier xml plat en utilisant XSLT
Je cherche un moyen propre à faire l'utilisation de XSLT suivante:
Convertir cette source:
<para>blah blah</para>
<list>num1</list>
<list>num2</list>
<list>num3</list>
<para>blah blah</para>
<list>num1</list>
<list>num2</list>
<para>blah blah blah blah blah</para>
Pour cette sortie:
<p>blah blah</p>
<ol>
<li>num1</li>
<li>num2</li>
<li>num3</li>
</ol>
<p>blah blah</p>
<ol>
<li>num1</li>
<li>num2</li>
</ol>
<p>blah blah blah blah blah</p>
Gardez à l'esprit, je ne sais pas exactement comment l'homme y <list>
il y aura.
Jusqu'à présent, j'ai ceci:
<xsl:template match="para">
<p><xsl:value-of select="." /></p>
</xsl:template>
<xsl:template match="list">
<ol><li><xsl:value-of select="." /></li></ol>
</xsl:template>
Mais ma sortie ressemble à ceci:
<p>blah blah</p>
<ol><li>num1</li></ol>
<ol><li>num2</li></ol>
<ol><li>num3</li></ol>
<p>blah blah</p>
<ol><li>num1</li></ol>
<ol><li>num2</li></ol>
<p>blah blah blah blah blah</p>
Je sais pourquoi je reçois en double <ol>
éléments, mais je ne sais pas comment l'arrêter . Tout un casse-tête.
Toute aide serait grandement appréciée.
Beaucoup, beaucoup de doublons: http://stackoverflow.com/questions/3813978/wrap-certain-nodes-with-xsl http://stackoverflow.com/questions/3776789/using-xslt-to-interpret-flat-xml -into-imbriqué-xhtml http://stackoverflow.com/questions/3831326/group-a-non-nested-xml-structure-to-a-xml-tree-structure http://stackoverflow.com/questions/3853452/grouping-of-similer-nodes –