xsl-list
[Top] [All Lists]

one great problem for showing the info into one table (from xml to html across xslt), please help me

2005-01-09 08:50:45
Hello i have one great problem. Is one great problem for me but i'm sure that is very simple the solution.
I am working into this problem several days but i cannot solve.

From one XML file, using xsl, i show (produce) html.
My problem is that i want to show the text into one celds (table) but i cannot put the text into their appropiate celds.


I show this:

<table bgcolor="#FFFFFF" cellspacing="1" cellpadding="0" border="0" width="100%"> <tr class="menuItem"><td width="45%">Noticias</td><td width="55%">Trucos</td></tr>
<tr class="links"><td>titulo de la noticia</td></tr>
<tr class="links"><td>titulo del truco</td></tr>
</table>

I want to show this:
<table bgcolor="#FFFFFF" cellspacing="1" cellpadding="0" border="0" width="100%"> <tr class="menuItem"><td width="45%">Noticias</td><td width="55%">Trucos</td></tr> <tr class="links"><td>titulo de la noticia</td><td>titulo del truco</td></tr>
</table>

the question is that if i find one <actual> node with the t value (true) i try to show its information into one table, i put, i want to put , into one col the information if the <ttipo_noticia> node = noticia and into other col if the <tipo_noticia> is = truco but only i can put into the sama col.


for making this i use the bellow xsl file and the bellow xml file.

Please can you help me?

The xsl is this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/registros">
<xsl:for-each select="registro">
<xsl:if test="actual='t'">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF"> <tr class="menuItem"><td width="45%">Noticias</td><td width="55%">Trucos</td></tr>
<tr class="links">
<td>
<xsl:for-each select="noticias/noticia">
<xsl:choose>
<xsl:when test="tipo_noticia='noticia'"><xsl:value-of select="titulo_noticiacastellano" disable-output-escaping="yes"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</td>
</tr>
<tr class="links">
<td>
<xsl:for-each select="noticias/noticia">
<xsl:choose>
<xsl:when test="tipo_noticia='truco'"><xsl:value-of select="titulo_noticiacastellano" disable-output-escaping="yes"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</td>
</tr>
</table>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>



this XML file is this:

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<registros>
<registro>
<actual>t</actual>
<noticias>
<noticia>
<titulo_noticiacastellano>titulo de la noticia</titulo_noticiacastellano>
<tipo_noticia>noticia</tipo_noticia>
</noticia>
<noticia>
<titulo_noticiacastellano>titulo del truco</titulo_noticiacastellano>
<tipo_noticia>truco</tipo_noticia>
</noticia>
</noticias>
<titulo_boletincastellano>titulo del boletin actual</titulo_boletincastellano>
</registro>
<registro>
<actual>f</actual>
<titulo_boletincastellano>titulode l boletin</titulo_boletincastellano>
</registro>
<registro>
<actual>f</actual>
<titulo_boletincastellano>Nuevo Boletin</titulo_boletincastellano>
</registro>
<registro>
<actual>f</actual>
<titulo_boletincastellano>titulodel bletin</titulo_boletincastellano>
</registro>
<registro>
<actual>f</actual>
<titulo_boletincastellano>titulod el boletin </titulo_boletincastellano>
</registro>
<registro>
<actual>f</actual>
<titulo_boletincastellano> titulo del boletin</titulo_boletincastellano>
</registro>
</registros>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>