Duda para mostrar desde xsl un campo de un xml
Publicado por Victor (2 intervenciones) el 10/10/2006 09:53:35
Hola
Tengo que mostrar un campo de un xml que contiene un fragmento html, como por ejemplo algo así:
<?xml version='1.0'?>
<RAIZ>
<TITULO>Esto es el titulo</TITULO>
<ELHTML>Esto es el codigo html, y esto <b>esta en negrita</b> aunque no es el unico estilo ya que esto <i>es cursiva</i>... en teoria, claro! Y esto otro aparte de salir <b>en negrita, también debería salir <i>en cursiva.</i></b></ELHTML>
</RAIZ>
El xsl me muestra bien el campo 'titulo', y si pongo el campo 'elhtml' ignora los tags <b> y <i>. Como puedo detectar estos tags y hacer que tengan un estilo diferente?
Simplificando, el xsl viene a ser algo así:
<xsl:template match="RAIZ">
<fo:table table-layout="fixed">
<fo:table-column column-width="16cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<xsl:apply-templates select="TITULO"/>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<xsl:apply-templates select="ELHTML"/>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
<xsl:template match="ELHTML">
<fo:block font-size="8pt" font-weight="bold" start-indent="3pt" font-family="Helvetica" line-height="12pt" space-after.optimum="3pt" text-align="left">
HTML: <xsl:value-of select="."/>
</fo:block>
</xsl:template>
--------
He intentado esto que vi en alguna página pero no he logrado nada postivo:
<xsl:template match="ELHTML">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
Alguien tiene alguna idea de como hacerlo?
Gracias por la ayuda :)
Tengo que mostrar un campo de un xml que contiene un fragmento html, como por ejemplo algo así:
<?xml version='1.0'?>
<RAIZ>
<TITULO>Esto es el titulo</TITULO>
<ELHTML>Esto es el codigo html, y esto <b>esta en negrita</b> aunque no es el unico estilo ya que esto <i>es cursiva</i>... en teoria, claro! Y esto otro aparte de salir <b>en negrita, también debería salir <i>en cursiva.</i></b></ELHTML>
</RAIZ>
El xsl me muestra bien el campo 'titulo', y si pongo el campo 'elhtml' ignora los tags <b> y <i>. Como puedo detectar estos tags y hacer que tengan un estilo diferente?
Simplificando, el xsl viene a ser algo así:
<xsl:template match="RAIZ">
<fo:table table-layout="fixed">
<fo:table-column column-width="16cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<xsl:apply-templates select="TITULO"/>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<xsl:apply-templates select="ELHTML"/>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
<xsl:template match="ELHTML">
<fo:block font-size="8pt" font-weight="bold" start-indent="3pt" font-family="Helvetica" line-height="12pt" space-after.optimum="3pt" text-align="left">
HTML: <xsl:value-of select="."/>
</fo:block>
</xsl:template>
--------
He intentado esto que vi en alguna página pero no he logrado nada postivo:
<xsl:template match="ELHTML">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
Alguien tiene alguna idea de como hacerlo?
Gracias por la ayuda :)
Valora esta pregunta


0