Re: [xsl] back again: child nodes in variable

Subject: Re: [xsl] back again: child nodes in variable
From: "Greg Newton" <gnewt@xxxxxxxxxxxxxx>
Date: Tue, 4 Jun 2002 17:11:41 -0700
Mike - I think the NOT will guarantee empty output:

<xsl:variable name="conhijos" select="mercados/mercado[not(subyacentes/*)]"/>


Shouldn't it be:

<xsl:variable name="conhijos" select="mercados/mercado[subyacentes/*]"/>


?

<!--
> first I need to put in a variable the "mercado" nodes getting
rid of 
> the ones with no "subyacentes" 
-->

Cheers
Greg (newbie)


======================================================

Date: Tue, 4 Jun 2002 12:30:33 -0600 (MDT) 
From: Mike Brown <mike@xxxxxxxx> 
Subject: Re: [xsl] back again: child nodes in variable 
 
Aniceto Lspez wrote: 
> this is part of the xml file: 
>  
> <mercados> 
> <mercado id="MERCADO" descripcion="CONTINUO"> 
> <subyacentes/> 
> </mercado> 
> <mercado id="M3" descripcion="MEFF RENTA VARIABLE"> 
> <subyacentes> 
> <subyacente id="20" descripcion="IBEX MINI"/> 
> <subyacente id="21" descripcion="IBEX PLUS"/> 
> </subyacentes> 
> </mercado> 
> <mercado id="MERCADO2" descripcion="CONTINUO2"> 
> <subyacentes/> 
> </mercado> 
> <mercado id="G1" descripcion="EUREX"> 
> <subyacentes> 
> <subyacente id="10" descripcion="Fut EURO SCHATZ"/> 
> <subyacente id="20" descripcion="Fut EURO BOBL"/> 
> </subyacentes> 
> </mercado> 
> </mercados> 
>  
> first I need to put in a variable the "mercado" nodes getting
rid of 
> the ones with no "subyacentes" 
 
You want: 
 
<xsl:variable name="conhijos" select="mercados/mercado[not(subyacentes/*)]"/>

 
> <xsl:for-each select="$conhijos/mercado/subyacentes/subyacente">

> <xsl:value-of select="@descripcion"/> 
> </xsl:for-each> 
 
Close. The selected set will contain only 'mercado' elements,
not 
their parent 'mercados', so when you iterate over them, you'd
use 
select="$conhijos/subyacentes/subyacente" 
 
- Mike 
____________________________________________________________________________

mike j. brown | xml/xslt: http://skew.org/xml/ 
denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/

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

 
-



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


Current Thread