[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [dssslist] FW: XPATH 'OR' Operator Syntax Question



Thanks for the heads-up Wendell!

-----Original Message-----
From: Wendell Piez [mailto:wapiez@mulberrytech.com]
Sent: Thursday, May 14, 2009 10:20 AM
To: dssslist@lists.mulberrytech.com; Joran, Peter
Subject: Re: [dssslist] FW: XPATH 'OR' Operator Syntax Question

Peter,

You have written DSSSList, not XSL-List. XSL-List will not hear your
question.

At 10:04 AM 5/14/2009, Joran, Peter wrote:
>All
>Do you know how to use an 'OR' operator in XPATH? I've looked on-line
>and I'm coming up empty.
>In the expression below I want to count records with a Status = Here OR
>Pending OR Accepted.
>
>All thoughts very welcome!
>Many Thanks
>Pete
>
>count(/dsQueryResponse/Rows/Row[normalize-space(@Status_) = 'Here' and
>normalize-space(@Classification_) = $fieldvalue]/@Source)

Your example uses the XPath 'and' operator. The 'or' operator is
precisely analogous; it performs a Boolean OR.

Depending on whether you are using XPath 1.0 or 2.0, along with
details of your requirements, further improvements can be made. For
example, where XPath 1.0 has

/path/to/node='a' or /path/to/node='b'

in XPath 2.0 you can say

/path/to/node=('a','b')

To pursue this further, you might subscribe to XSL-List as described
at http://www.mulberrytech.com/xsl/xsl-list/.

Good luck,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================