Try this instead of the inner code loop (I may have misinterpreted your
request :), so it may not do what you want):

                 <xsl:for-each  select="img">
                       <IMG src="{@url}" border="1" height="125"
width="95"/>
                 </xsl:for-each>

If you do this:
                 <xsl:for-each  select="/Libros/Libro/img">
the xsl tag will match both images, inside both <Libro> tags...


Hope that helps.
Tibi Dondera



----- Original Message -----
From: Ivan Manuel Andrade Muñoz
To: [EMAIL PROTECTED]
Sent: Wednesday, January 30, 2002 3:11 PM
Subject: Help, help, help, bucle for-each that is repeated twice.


Hello all.

My problem, is that not like solving that my bucle for-each shows the two to
me imagenes together and not like separating them or giving an option them
so that xml does not show to meetings when executing my file to it.

My file .xml:

books.xml
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<?xml-stylesheet href="books.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<!DOCTYPE Libros SYSTEM "books.dtd">
<Libros>
 <Libro Idioma="Inglés">
  <Nombre>
        Designing XML Internet Applications
        </Nombre>
  <img url="book1.gif"/>
                <Precio>
                   67.55 USD
                </Precio>
 </Libro>
 <Libro Idioma="Inglés">
  <Nombre>
         Perl 5 Complete
         </Nombre>
  <img url="book2.gif"/>
                <Precio>
                   72.75 USD
                </Precio>
 </Libro>
</Libros>

My file .xsl:
books.xsl
<?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="/">

<xsl:processing-instruction name="cocoon-format">
   type="text/html"
</xsl:processing-instruction>
<HTML>
 <HEAD>
  <TITLE>
   Libro
  </TITLE>
 </HEAD>
        <BODY>
                        <CENTER><IMG src="Linea.gif"/>
                                <H1>
         VENTA LIBROS
    </H1>
           <IMG src="Linea.gif"/>
                        </CENTER>
    <H2>
                                <BR>
      SELECCIONE EL LIBRO QUE DESEA COMPRAR:
                                </BR>
    </H2>
 <FORM action="http://localhost/cgi-bin/prueba1.pl"; method="POST"
enctype="TEXT/PLAIN">
        <xsl:for-each select="Libros/Libro">
        <CENTER>
        <H3>
        <INPUT type="radio" name="Libro" value="1"/>
        <xsl:value-of select="Nombre"/>
        </H3>
        </CENTER>
        <CENTER>
           <TABLE align="CENTER" border="0">
              <TR>  <!-- Unica Fila -->
                 <TD>
                 <H6>
                    <BR>
                    Idioma:
                    <FONT color="#000000" size="2">
                    </FONT>
                    <xsl:value-of select="@Idioma"/>
                    </BR>

                 </H6>
                 </TD>
                 <TD>
                 <!-- Error the show imagen -->
                 <xsl:for-each  select="/Libros/Libro/img">
                       <IMG src="{@url}" border="1" height="125"
width="95"/>
                 </xsl:for-each>
                 <!-- End Error -->
                 </TD>
                 <TD>
                 <BR/>
                 </TD>
                 <TD>
                 <H6>
                    <BR>
                    <FONT color="#000000" size="2">
                    Precio:
                    </FONT>
                    <xsl:value-of select="Precio"/>
                    </BR>
                 </H6>
                 </TD>
              </TR>
           </TABLE>
        </CENTER>
        </xsl:for-each>
        <P/>
        <CENTER>
        <IMG src="Linea.gif"/>
        <P/>
        <INPUT type="submit" value="Ver Libros"/>
        <INPUT type="reset" value="Borrar Seleccion"/>
        <P/>
        <IMG src="Linea.gif"/>
        <P/>
        <A href="Tarea4a.html"> <IMG src="ant.gif"/> </A>
        <P/>
        </CENTER>
  </FORM>
 </BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

My file .dtd :
books.dtd

<!ELEMENT Libros (Libro+)>
<!ELEMENT Libro (Nombre, img, Precio)>
<!ATTLIST Libro Idioma CDATA #REQUIRED>
<!ELEMENT Nombre (#PCDATA)>
<!ELEMENT img EMPTY>
<!ATTLIST img url CDATA  #REQUIRED>
<!ELEMENT Precio (#PCDATA)>

As it shows to the file books.xml to me in cocoon, with imagenes repeated.

Thank you all.
Ivan Andrade M.
Punta Arenas.
Chile.




Con MSN Hotmail súmese al servicio de correo electrónico más grande del
mundo. http://www.hotmail.com/ES
--------------------------------------------------------------------- Please
check that your question has not already been answered in the FAQ before
posting. To unsubscribe, e-mail: For additional commands, e-mail:

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to