Re: [xsl] multiple node values not being returned

Subject: Re: [xsl] multiple node values not being returned
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 20 May 2005 13:11:51 +0100
  <xsl:for-each select="$interim/A/Value">
             <xsl:variable name="aVal" select="."/>
            <xsl:value-of select="distinct-values($aVal[for $a in . 
  return $oVal[contains(.,$a)]])"/>
               <xsl:if test="position() != last()"><xsl:value-of select="' 
  '"/></xsl:if>
  </xsl:for-each>   


there you are just generating text so you could have done it with a
single value-of and xpath (as I showed originally).
Do you want to generate text (as here) or element nodes (as in your
original message in this thread) the techniques required are rather
different in the two cases.

You have copied my 
$aVal[for $a in .
code but here (as I said the other day) as  it is not doing anything
useful as $aVal is a single node in this case not the set of all A nodes
as in the first solution I posted. Similarly distinct-values() isn't
doing anything at all as there is (at most) one value on the sequence:
you are starting with . and then filtering that with a predicate.

             <xsl:variable name="aVal" select="."/>
            <xsl:value-of select="distinct-values($aVal[for $a in . 
  return $oVal[contains(.,$a)]])"/>

is just testing if the string value of the current node is contained in
an oVal node, so it is just something like:

            <xsl:value-of select="if ($oVal[contains(.,current())])
              then . else ()"/>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread