This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Union of two node-sets not producing desired result (Resent due to outage)
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Union of two node-sets not producing desired result (Resent due to outage)
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Mon, 17 Sep 2001 14:38:23 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
As this question relates to a Xalan extension function, it may be best to
raise it on the Xalan list rather than here.
Mike Kay
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Joel Beach
> Sent: 17 September 2001 14:10
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Union of two node-sets not producing desired result
> (Resent due to outage)
>
>
> ----- Original Message -----
> From: "Joel Beach" <joelbeach@optushome.com.au>
> To: <xsl-list@lists.mulberrytech.com>
> Sent: Saturday, September 15, 2001 1:02 AM
> Subject: Union of two node-sets not producing desired result
> (probable easy
> question ;-))
>
>
> > Can anyone elighten me as to why the union of two sets
> shown below (marked
> > with ^^^^^) results in a node-set of only two elements?
> >
> > Both node sets are produced by the tokenize() extension
> function.......one
> > is a fixed string for now 'Multiple'. The other is a node
> set generated
> from
> > a text node in an XML document....
> > The node sets generated by tokenize() seem to be fine, as I can use
> > xsl:for-each to loop through the node-set and print all the
> elements out.
> It
> > all looks good....The relevant fragment of the XML is shown below
> >
> > <Trial>
> > <TrialName>Do Multiple Trials work</TrialName>
> > </Trial>
> >
> > And the template contained in the XSL stylesheet is shown
> below.....clearly
> > the Union of
> > { 'Do', 'Multiple', 'Trials', 'Work' } and { 'Multiple' }
> should be give a
> > count of 4, yet I get a count of 2, and the elements
> contained in the
> union
> > are 'Do' and 'Multiple'. I feel stupid, but I can't find
> the problem in my
> > code, given that I'm pretty much a complete beginner at
> XSL. On another
> > note, what's the best way to case-insensitive unions?
> Convert strings to
> > upper case first? Is the best way to do this to use
> translate and use
> > variables which include all the characters in the alphabet?
> >
> > Thank,
> >
> > Joel
> >
> > <xsl:template match="Trial">
> > <xsl:variable name="trialNameWords"
> > elect="xalan:tokenize( TrialName[text()], '- ' )"/>
> > <xsl:variable name="trialSearchWords"
> > elect="xalan:tokenize( 'Multiple', '- ' )"/>
> >
> > <xsl:if test="$trialSearchWords = $trialNameWords">
> > <xsl:text>We have a Match!!!!!</xsl:text>
> > </xsl:if>
> > <br/>
> >
> > <xsl:value-of select="count( $trialSearchWords |
> $trialNameWords )"/>
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> > </xsl:template>
> >
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list