RE: [xsl] multiple node values not being returned

Subject: RE: [xsl] multiple node values not being returned
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 20 May 2005 14:37:04 +0100
> In trying to solve a problem I have encountered another problem where 
> all the A/Value text are not being returned. Instead only the first 
> A/Value term is being returned.

My guess is that your stylesheet specifies version="1.0", which means that
xsl:value-of will do the "1.0 thing" and output only the first item in the
selected sequence.

Michael Kay
http://www.saxonica.com/


> 
> Heres my code.
> 
> <xsl:variable name="map" select="document('input.xml')"/>
> <xsl:variable name="interim" 
> select="$map/TopConcept/*[name()=$aTerm]"/> 
> <!-- where $aTerm='Parts' -->
>           <xsl:message>Interim = <xsl:value-of 
> select="$interim"/></xsl:message>  <!-- Interim = Parts 
> Handle Bolt Nut 
> No ClassName -->                                              
>           
>            <xsl:variable name="aVal" select="for $x in 
> $interim/A/Value 
> return normalize-space($x)"/>
>     
>           <xsl:message>A Val= <xsl:value-of select="$aVal"/> 
> </xsl:message> <!-- A Val = Handle -->
> </xsl:variable>
> 
> I expect 'A Val' to return 'Hande Bolt Nut' but it only 
> returns 'Handle'.
> 
> What could the problem be considering $interim contains all 
> the values 
> correctly ? My input.xml file is attached below:
> 
> --------------
> input.xml
> --------------
> <Parts>
>    <A>
>     <Class id="123" type="none">Parts</Class>
>     <Value id="345" type="text">Handle</Value>
>     <Value id="456" type="text">Bolt</Value>
>     <Value id="567" type="text">Nut</Value>
>    </A>
>     <B>
>     <Class id="none" type="Property">No ClassName</Class>
>     </B>
> </Parts>
> 
> Appreciate any help.
> 
> Thanks
> Rahil

Current Thread