This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: OR in test
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "ashu t" <aashut at rediffmail dot com>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Thu, 4 Jul 2002 13:48:52 +0100
- Subject: Re: [xsl] OR in test
- Organization: Jeni Tennison Consulting Ltd
- References: <20020704123427.25962.qmail@webmail26.rediffmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Ashu,
> but it is not working .i want to know that is it wrong to use or(|)
> in test.if yes then what should be the right way.
In XPath, 'or' is 'or'. '|' is the union operator, which unions
together two or more node sets to create another one. (This sometimes
gives the same result as 'or', but that's because when you test a node
set, it's "true" when the node set has a node in it and false
otherwise.)
So use:
<xsl:if test="$type='text' or $type='password'">
...
</xsl:if>
> and what if in html text is written as TEXT(in capitals). as in wml
> only two (text and password) input types are allowed
Then you need to test whether $type, converted to lowercase, is 'text'
or not. You can convert to lowercase using the translate() function.
Perhaps you want:
<xsl:if test="translate($type, 'TEX', 'tex')='text' or
translate($type, 'PASWORD', 'pasword')='password'">
...
</xsl:if>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list