[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: one great problem for showing the info into one ta

Subject: Re: one great problem for showing the info into one table (from xml to html across xslt), please help me
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Sun, 09 Jan 2005 20:52:22 +0100
xml xsl if great
Tempore 16:50:45, die 01/09/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Dionisio Ruiz de Zarate <dionisio@xxxxxxxxxxxxx>:

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.
Hi,

There are probably better solutions to solve this problem, but the following stylesheet should work - It does the task that I understood from your question.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>


<xsl:template match="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>
<xsl:variable name="count1" select="count(noticias/noticia[tipo_noticia='noticia'])"/>
<xsl:variable name="count2" select="count(noticias/noticia[tipo_noticia='truco'])"/>
<xsl:variable name="maximum">
<xsl:if test="$count1 &gt;= $count2"><xsl:value-of select="$count1"/></xsl:if>
<xsl:if test="$count1 &lt; $count2"><xsl:value-of select="$count2"/></xsl:if>
</xsl:variable>
<xsl:for-each select="noticias/noticia[position() &lt;= $maximum]">
<xsl:variable name="count" select="position()"/>
<tr class="links">
<td><xsl:apply-templates select="../noticia[tipo_noticia='noticia'][position()=$count]"/></td>
<td><xsl:apply-templates select="../noticia[tipo_noticia='truco'][position()=$count]"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:if>
</xsl:template>


<xsl:template match="noticia">
<xsl:value-of select="titulo_noticiacastellano" disable-output-escaping="yes"/>
</xsl:template>


</xsl:stylesheet>


regards,


--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
"Et ipsa scientia potestas est"  - Francis Bacon , Meditationes sacrae

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.