Subject: RE: Using contains() with for-each
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 26 Jul 2005 23:32:26 +0100
|
contains(A, B) is true if A contains B, not if B contains A.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Grant, Kathryn --- Sr. Technical Writer --- WGO
> [mailto:Kathryn.Grant@xxxxxxxxxxxxxxxxx]
> Sent: 26 July 2005 23:07
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Using contains() with for-each
>
> Hello,
>
> I'm working with this XML (simplified):
>
> <keyrec>
> <keyword>APT1</keyword>
> <desc>Appt: Setup:</desc>
> <keywd_type>X B</keywd_type>
> </keyrec>
> <keyrec>
> <keyword>APT2</keyword>
> <desc>Appt: Confirm</desc>
> <keywd_type>B</keywd_type>
> </keyrec>
>
>
> <keywd_type> may contain the letters B, R, X, any combination of the
> three (separated by spaces), or nothing at all.
>
> My (working) XSL contains the following:
>
> <xsl:for-each select="//keywordtable/keyrec[keywd_type='B']">
>
> Now I need to alter it so it's looking for records that *contain* B
> rather than equaling B. So I tried this:
>
> <xsl:for-each select="//keywordtable/keyrec[contains('B',
> keywd_type)]">
>
> But this brings up records that contain *only B* or *nothing at all*.
>
> What am I doing wrong?
>
> Thanks in advance!
>
> Kathryn
>
>
> *******************************************************
> This message contains information that is confidential
> and proprietary to FedEx Freight or its affiliates.
> It is intended only for the recipient named and for
> the express purpose(s) described therein.
> Any other use is prohibited.
> *******************************************************
|