I try to modified a xml document that has html inside a tag I can transform <p> and list but I have bold and italics inside. How can I make this? I use xslt templates to transform.
This is my code:
<Memoria>
<titulo>Memoria EUITI 2010</titulo>
<Indice>
<titulo>Indice 2010</titulo>
<secciones>
<seccion>
<parent_id>1</parent_id>
<titulo>INFORMACIÓN GENERAL</titulo>
<contenido><p><strong>ESTO</strong> ES UNA <em>PRUEBA</em></p></contenido>
<ul>
<li> caso de poner</li>
</ul>
<p>Ver si funciiona esto que si funciona ya esta</p>
<p> </p></contenido
</seccion>
</secciones>
</Indice>
</Memoria>
I use this xslt transformation:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<Memoria>
<xsl:apply-templates select="//Memoria"/>
</Memoria>
</xsl:template>
<xsl:template match="text()"/>
<xsl:template match="titulo">
<titulo>
<xsl:value-of select="."/>
</titulo>
</xsl:template>
<xsl:template match="Indice/titulo">
<Indice>
<xsl:value-of select="."/>
</Indice>
</xsl:template>
<xsl:template match="Indice/secciones/seccion">
<Seccion>
<xsl:apply-templates select="contenido|titulo"/>
</Seccion>
</xsl:template>
<xsl:template match="Indice/secciones/seccion/titulo">
<nombre_seccion>
<xsl:value-of select="."/>
</nombre_seccion>
</xsl:template>
<xsl:template match="contenido">
<Contenido>
<xsl:apply-templates select="p|ul"/>
</Contenido>
</xsl:template>
<xsl:template match="p">
<p>
<xsl:value-of select="."/>
</p>
</xsl:template>
<xsl:template match="ul">
<ul>
<xsl:for-each select="li">
<li>
<xsl:value-of select="."/>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
With this template I get a xml valid document but this document doesn't get inside:
<contenido><p><strong>ESTO</strong> ES UNA <em>PRUEBA</em></p></contenido>
How can I make this?
On the other hand I want to transform this result document with another XSLT in XSL-FO to generate a PDF with FOP. I can generate p and a list but I can't generate bold and cursive.
Is this the correct way to do this:
HTML->XML->XSL-FO
or are there any ways to transform the code directly?
root, foo, bar, child. Keep your question simpler and neat .. try to reduce your work XML docs to sample XMLs, so that it would be readable and easily understandable. Questions like this hardly sound interesting ..