Ciao, ho un problema nel formattare un file xml in html. La situazione è questa: all'interno di un tag <DESCRIPTION> sono presenti degli altri tag che mi vanno a definire del testo in bold [B], sottolineato <U>, ecc. Ora come ora ho creato una porzione di codice xsl che mi trasforma questi tag in tag html e il testo all'interno me lo fa diventare nel corrispondente stile. Il problema viene quando all'interno di un tag ce ne sono degli altri, come in questa situazione: <U>Misto</U> e allora mi trasforma solamente quello più esterno. Posto il codice che ho scritto.
Spero di essere stato abbastanza chiaro.codice:<xsl:template match="DESCRIPTION"> <xsl:for-each select="text()|B|I|U|BR|ALIGN[@value='justify']|ALIGN[@value='left']|ALIGN[@value='center']|ALIGN[@value='rigth']"> <xsl:apply-templates select="."/> </xsl:for-each> </xsl:template> <xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template> <xsl:template match="B"> <xsl:value-of select="."/> </xsl:template> <xsl:template match="I"> <xsl:value-of select="."/> </xsl:template> <xsl:template match="U"> <u><xsl:value-of select="."/></u> </xsl:template> <xsl:template match="BR"> </xsl:template> <xsl:template match="ALIGN[@value='justify']"> <span style="text-align:justify"><xsl:value-of select="." /></span> </xsl:template> <xsl:template match="ALIGN[@value='left']"> <span style="text-align:left"><xsl:value-of select="." /></span> </xsl:template> <xsl:template match="ALIGN[@value='center']"> <span style="text-align:center"><xsl:value-of select="." /></span> </xsl:template> <xsl:template match="ALIGN[@value='rigth']"> <span style="text-align:rigth"><xsl:value-of select="." /></span> </xsl:template>

Rispondi quotando
))
