Re: [xsl] Problem in xsl:for-each

Subject: Re: [xsl] Problem in xsl:for-each
From: jam@xxxxxxxxxxxxx
Date: Thu, 10 Jan 2002 18:20:24 +0100
I've tried with your solution and it does not generate the foreseen 
result

I send a copy of my XSLT.

<?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="html" encoding="iso-8859-1"/>
 <xsl:template match="/">
  <html>
   <body>
    <xsl:for-each select="document
('Todos.xml')/todosFicheros/fichero/text()">
     <xsl:variable name="Nombre_Fichero" select="document(string(.))"/>
     <xsl:text>  Fichero: </xsl:text>
     <xsl:value-of select="."/>
     <br>
     </br>
     <xsl:text>Titulo : </xsl:text>
     <xsl:value-of select="$Nombre_Fichero//Titulo"/>
     <br>
     </br>
     <xsl:text>Entradilla : </xsl:text>
     <xsl:value-of select="$Nombre_Fichero//Entradilla"/>
     <br>
     </br>
     <xsl:for-each select="document
($Nombre_Fichero)//Documento/Noticia/Cuerpo/Parrafo">
      <xsl:text>Parrafo : </xsl:text>
      <xsl:copy-of select="$Nombre_Fichero//."/>
      <br>
      </br>
     </xsl:for-each>
     <br>
     </br>
    </xsl:for-each>
   </body>
  </html>
 </xsl:template>
</xsl:stylesheet>


The output generated in the XSLT is correct except the loop 'for-each' 
sent in the first mail.
What I wanted to get is the contents in the node 'Parrafo' 


Cheers,
JAM




----- Original Message ----- 
From: "Jeni Tennison" <jeni@xxxxxxxxxxxxxxxx>
To: <jam@xxxxxxxxxxxxx>
Cc: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, January 10, 2002 5:58 PM
Subject: Re: [xsl] Problem in xsl:for-each


> Hi Jam,
> 
> > I'm trying to access to all items in node 'Parrafo'.
> > Variable $Nombre_Fichero contains a valid filename .
> > This XSL does not output all elements. (This is the real problem )
> >
> > <xsl:for-each 
> > select="$Nombre_Fichero//Documento/Noticia/Cuerpo/Parrafo">
> >         <xsl:copy-of select="$Nombre_Fichero//."/>
> >         <br>
> >         </br>
> > </xsl:for-each>
> 
> Perhaps you want:
> 
>   <xsl:for-each
>       select="$Nombre_Fichero//Documento/Noticia/Cuerpo/Parrafo">
>     <xsl:copy-of select="." />
>     <br />
>   </xsl:for-each>
> 
> This will give you a copy of each Parrafo element, separated by br
> elements.
> 
> But you said that $Nombre_Fichero contained a filename (and not a node
> set, which is what it would have to hold for the above file to work),
> so possibly you're actually after:
> 
>   <xsl:for-each
>       select="document
($Nombre_Fichero)//Documento/Noticia/Cuerpo/Parrafo">
>     <xsl:copy-of select="." />
>     <br />
>   </xsl:for-each>
> 
> Feel free to post more details about your source document and the
> output that you want to generate if the above doesn't work.
>   
> Cheers,
> 
> Jeni
> 
> ---
> Jeni Tennison
> http://www.jenitennison.com/
> 


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


Current Thread