Ho una domanda abbastanza stupida. Come posso assicurarmi che il mio nodo di contenuto misto XML non venga confuso? Ho, diciamo, una struttura XML che assomiglia a questo.Nodo contenuto XSLT
<root>
<book>
<title>Stuff</title>
<description> This book is <i>great</i> if you need to know about stuff.
I suggest <link ref="Things">this one</link> if you need to know
about things. </description>
</book>
[other books]
</root>
Ho bisogno il contenuto finale per assomigliare a questo
<h1>List of books</h1>
<h2><a name="Stuff"/>Stuff</h2>
<p> This book is <i>great</i> if you need to know about stuff.
I suggest <a href="#Things">this one</a> if you need to know
about things. </p>
ma non riesco a estrarre le parti del nodo di testo, ho sempre afferrare il tutto. Sto usando l'asse discendente. Qualche idea su cosa sto facendo male?
Ecco il mio XSLT:
<xsl:template match="description/*">
<xsl:for-each select="following-sibling::*">
<xsl:choose>
<xsl:when test="name(.)='link'">
<a href="{@ref}"><xsl:value-of select="."/></a>
</xsl:when>
<xsl:when test="name(.)='em'">
<em><xsl:value-of select="."/></em>
</xsl:when>
<xsl:otherwise><p><xsl:value-of select="."/></p></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
Si prega di notare che l'XML chiusa e conseguente html sono solo esempi, ho a che fare con una struttura più grande che io non sono che racchiude in, per motivi di chiarezza.
mente condividere il tuo xslt? –
XSLT è stato condiviso. –