Hola quisiera saber si es posible convertir un documento que no tiene marcado los br como por ejemplo
<xml>
<prueba>
Por ejemplo
Este texto en 2 reglones HTML
</prueba>
Para que en el navegador me lo muestre como cada linea independiente ... muchas gracias!!
SOLUCION: (usando
GTraductor consegui las
Keywords de "saltos de línea en XML")
Esta pagina contiene info relativa al HTML pero el ejemplo no esta completo
Aca hay un FAQ IMPRESIONANTE!!!
http://www.dpawson.co.uk/xsl/sect2/N7240.html
y aca el codigo [Nota: Me falta lograr añadirle los Tags html arriba y abajo por ejmplo <html></html> si alguien sabe como postee, gracias!]
Código:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="html" version="1.0" encoding="ISO-8859-1" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="texto//text()">
<xsl:call-template name="make-verbatim">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template name="make-verbatim">
<xsl:param name="text" select="''"/>
<xsl:variable name="starts-with-space"
select="substring($text, 1, 1) = ' '"/>
<xsl:variable name="starts-with-nl"
select="substring($text, 1, 1) = '
'"/>
<xsl:variable name="before-space">
<xsl:if test="contains($text, ' ')">
<xsl:value-of select="substring-before($text, ' ')"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="before-nl">
<xsl:if test="contains($text, '
')">
<xsl:value-of
select="substring-before($text, '
')"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$starts-with-space">
<xsl:text>*</xsl:text>
<xsl:call-template name="make-verbatim">
<xsl:with-param name="text"
select="substring($text,2)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$starts-with-nl">
<br/><xsl:text>
</xsl:text>
<xsl:call-template name="make-verbatim">
<xsl:with-param name="text"
select="substring($text,2)"/>
</xsl:call-template>
</xsl:when>
<!-- if the string before a space
is shorter than the string before
a newline, fix the space...-->
<xsl:when test="$before-space != ''
and ((string-length($before-space)
< string-length($before-nl))
or $before-nl = '')">
<xsl:value-of select="$before-space"/>
<xsl:text>*</xsl:text>
<xsl:call-template name="make-verbatim">
<xsl:with-param name="text"
select="substring-after($text, ' ')"/>
</xsl:call-template>
</xsl:when>
<!-- if the string before a newline
is shorter than the string before
a space, fix the newline...-->
<xsl:when test="$before-nl != ''
and ((string-length($before-nl)
< string-length($before-space))
or $before-space = '')">
<xsl:value-of select="$before-nl"/>
<br/><xsl:text>
</xsl:text>
<xsl:call-template name="make-verbatim">
<xsl:with-param name="text"
select="substring-after($text, '
')"/>
</xsl:call-template>
</xsl:when>
<!-- the string before the newline and the string before the
space are the same; which means they must both be empty -->
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>