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

compare with the preceding value

Subject: compare with the preceding value
From: "Dionisio Ruiz de Zarate" <dionisio@xxxxxxxxxxxxx>
Date: Sun, 1 Dec 2002 16:19:35 +0100
xsl compare preceding
i have the bellow xml file and i want to show this:

<table>
<tr>
<td>nombre1</td><td>curso11</td>
</tr>
<tr>
<td></td><td>curso12</td>
</tr>
<tr>
<td></td><td>curso13</td>
</tr>
</table>

if the nobre1 is in the preceding node only write the curso1X value and if
is not in the preceding node write.
for this y have this files (XML and XSLT) but i cannot make that, i cannot
compare with the preceding node.
can you help me?
if youe see the XML file you can see that there are a lot of registro nodes
and for each there is one nombremaquina tag (filed) i this field has the
same value in the preceding registro node i dont want to print but is not
the same value yes.

Can you help me?
thnaks

XSLT file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes"/>
<xsl:template match="registros">
<xsl:for-each select="registro">
<xsl:call-template name="maquinas"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="maquinas">
<table>
<xsl:choose>
<xsl:when test="nombremaquina='<xsl:value-of
select="../registro/nombremaquina"/>'">
<tr>
<td></td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr>
<td><xsl:value-of select="nombremaquina"/></td>
</tr>
</xsl:otherwise>
</xsl:choose>
</table>
</xsl:template>
</xsl:stylesheet>

Tha XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<registros>
<registro>
<id>2</id>
<nombremaquina>nombre1</nombremaquina>
<idcurso>56</idcurso>
<nombrecursocastellano>curso11</nombrecursocastellano>
<imagen>MEDIA_CO.jpg</imagen>
</registro>
<registro>
<id>2</id>
<nombremaquina>nombre1</nombremaquina>
<idcurso>56</idcurso>
<nombrecursocastellano>curso12</nombrecursocastellano>
<imagen>MEDIA_CO.jpg</imagen>
</registro>
<registro>
<id>2</id>
<nombremaquina>nombre1</nombremaquina>
<idcurso>56</idcurso>
<nombrecursocastellano>curso13</nombrecursocastellano>
<imagen>MEDIA_CO.jpg</imagen>
</registro>
<registro>
<id>2</id>
<nombremaquina>nombre2</nombremaquina>
<idcurso>56</idcurso>
<nombrecursocastellano>curso21</nombrecursocastellano>
<imagen>MEDIA_CO.jpg</imagen>
</registro>
<registro>
<id>2</id>
<nombremaquina>nombre2</nombremaquina>
<idcurso>56</idcurso>
<nombrecursocastellano>curso22</nombrecursocastellano>
<imagen>MEDIA_CO.jpg</imagen>
</registro>
<registro>
<id>2</id>
<nombremaquina>nombre3</nombremaquina>
<idcurso>56</idcurso>
<nombrecursocastellano>curso31</nombrecursocastellano>
<imagen>MEDIA_CO.jpg</imagen>
</registro>
<registro>
<id>2</id>
<nombremaquina>nombre3</nombremaquina>
<idcurso>56</idcurso>
<nombrecursocastellano>curso32</nombrecursocastellano>
<imagen>MEDIA_CO.jpg</imagen>
</registro>
</registros>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.