testing a field

M

Michael Hill

I have a xslt stylesheet where I need to test for not one item, but
many.

I know I can do:

<xsl:test="field='one'">

but if I have a list to check like:

'one', 'two', 'three' how would I check those.

This does not work:

<xsl:test="field='one|two|three'">

Mike
 
M

Michael Hill

<xsl:if test="field='one'|field='two'|field='three'">

-- Richard

Does not work. I am getting this error message:


Expression does not return a DOM node.
status=-->'Approved'|<--status='Proposed'

Mike
 
R

Richard Tobin

<xsl:if test="field='one'|field='two'|field='three'">
[/QUOTE]

Oops, I meant "or" not "|":

<xsl:if test="field='one' or field='two' or field='three'">

-- Richard
 
J

Joris Gillis

Tempore 02:36:58 said:
I have a xslt stylesheet where I need to test for not one item, but
many.

I know I can do:

<xsl:test="field='one'">

but if I have a list to check like:

'one', 'two', 'three' how would I check those.
Hi,

use the 'contains()' function an a string version of the possible values. Choose a separator that will not occur in the 'field' element's text nodes.
In most occassions, this will work:
<xsl:if test="contains('one,two,three',field)" />

regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top