Implementing Equality Expressions...

Subject: Implementing Equality Expressions...
From: Tyler Baker <tyler@xxxxxxxxxxx>
Date: Fri, 01 Jan 1999 18:31:06 -0500
In the XSL Spec Boolean Expressions are defined as follows...

BooleanExpr ::= AndExpr | OrExpr | BooleanPrimaryExpr
BooleanPrimaryExpr ::= BooleanGroupExpr | NotExpr | PositionalExpr |
TestExpr | EqualityExpr

When trying to parse an equality expression directly, I have found that
it is very difficult to separate the SelectExpression from the Literal
when and expressions or or expressions are also present.

The algorithm I use is basically is to find the first '=' that is not in
a nested expression "anything inside '(' and ')'" and not inside a
literal.  The problem arises is that if you encounter an "and" or an
"or" then you will

I suppose first looking ahead and breaking everything up in terms of
"and" and "or" components would work nicely, but scanning an entire
string expression ahead of time for occurrences of "and" as well as "or"
is suboptimal.

However, if And as well as Or expressions were composed only of
BooleanGroupExpressions, then this problem would be resolved in at least
my implementation (the enclosing '(' and ')' would be used as delimiters
for the beginning and ending of the equality expression).

So instead of having a boolean expression

[foo and @bar="baz"]

You would always have:

[(foo) and (@bar="baz")]

This construction I have found is a lot easier to parse than the way
things currently are defined.

To be specific all I am asking for is that:

AndExpr ::= BooleanPrimaryExpr ( 'and' BooleanPrimaryExpr )+

be changed to:

AndExpr ::= BooleanGroupExpr ( 'and' BooleanGroupExpr )+

and that:

OrExpr ::= BooleanPrimaryExpr ( 'or' BooleanPrimaryExpr )+

be changed to:

OrExpr ::= BooleanGroupExpr ( 'or' BooleanGroupExpr )+

Has this been considered already among the WG?

Tyler

P.S. - This only causes problems for me with parsing equality
expressions but not with anything else...


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread