[
Lists Home |
Date Index |
Thread Index
]
> >- it does a different thing: XPath is a language for
> >addressing parts of
> > a document, Relax NG, and the way it is used in ARX, the
> >utility we are discussing,
> > assesses that a document matches a regular pattern.
>
> If you wrap boolean() around your XPath expressions and limit them to
> expressions that evaluate to a node set then you have the same thing.
Dare, no, I don't have the same thing. It will still be a language
for addressing part of a documents used to identify a document's
type based on presence or absence of certain parts.
The difference is not in boolean(), or what it evaluates to.
The difference is closure. If 'a' and 'b' are regular expressions,
then 'a op b' is a regular expression too.
Having file globbing syntax for XPath is convenient in limited cases.
It can be an obstacle in others, and there is no reason why XPath,
a limited addressing syntax, should be adopted for matching.
To check whether a particular document is DocBook Website XML, one
writes (in relax ng compact):
element webpage {attribute *{text}|(element head {any},dbbookcontent}
('any' and 'docbookcontent' are defined elsewhere). The equivalent
in XPath requires writing in square brackets an algorithm required
to interpret a part of this expression, and the more things one combines,
the more program code has to be embedded into the XPath expression.
One can find an application where augmenting a regular xml grammar with
computations is useful, but for the purpose of classifying documents
a regular syntax is powerful enough to go alone.
XPath's patterns alone are not powerful enough. They require augmenting
with predicates, that is, with snippets of code which compute functionally
things xpath's syntax cannot express declaratively.
Having a formalism that does the job is, in my opinion, better
than having a combination of less powerful formalism (paths) that does not,
and another formalism (predicates) to patch the former.
> >Note 1. However, I would find an XSLT-like language that
> >provides XML regular expressions (similar to Relax NG) for
> >matching and selection more useful and convenient, if
> >occasionally less verbose, than XSLT; if string regular
> >expressions (which are peripheral to the area of XSLT) were
> >added, why XML regular expressions were not?
>
> Sounds like XQuery.
Not at all. Regular expressions don't have 'Q|y' in their name, while
XQuery does. Why do you think they sound similar?
David Tolpin
|