[Xpath-ng] Proposal for static context syntax
Robin Berjon
robin.berjon at expway.fr
Fri Nov 29 08:16:22 MST 2002
Hi David,
David Rosenborg wrote:
>>I'm not against using RelaxNG notation, but why not use XPointer's?
>>xmlns(foo=http://...)? Somehow it feels more xpathish to me (but then that
>>makes it a personal aesthetic statement). Provided we quoted the content, it'd
>>follow the Function production of XPath 1.0, which may be a plus for backcompat (in
>>which case import foo:* would also become import("foo:*")).
>
> In my opinion, the XPointer syntax feels rather contrived when taken
> out of its context. That is, it works well with XPointer but
> the RELAX NG (and also XQuery which i similiar) feels much
> more natural in general.
I think we may be considering XPath in different contexts. You seem to be
tending towards full scripting, while I'm still considering the one-liners I use
in XSLT and other programming languages. Given a one-liner, I feel a more
compact syntax is easier to read.
It could well be namespace("prefix", "URI").
> Also, why make it look like a function when it's not?
So that an XPath 1.0 processor could parse it even if it doesn't understand it.
I'm still unsure whether or not that's a requirement worth having, but it could
be. I like the failsafety of CSS.
>>> The static context preamble appears before any other XPath Ng constructs.
>> Is that truly necessary? Also, why must it be static? :)
>
> I believe it makes the syntax clearer an a bit easier to process. Also it's
> consitent with RELAX NG and XQuery.
I think that best practices in programming is an issue orthogonal to language
design. In other words, a language shouldn't even think about enforcing what are
perhaps good ideas, but aren't technical limitations to what the language needs
to operate properly. One reason for this is that it's likely that it'll cause
undeserved problems to someone down the line (eg trying to merge two XPath NG
scripts without to much munging). Another is that it is never enough to properly
define best practices (eg enforcing strong typing but not cast safety, checked
exceptions but no imposed action on catch...). Push that a little too far and
you get Java ;)
I know that I would always declare my namespaces and perform my imports at the
top (except perhaps if we start having and eval() function...), I just don't see
why it should be enforced. The processing isn't made all that much easier, if
any easier at all.
> The term static context is taken from XPath 2.0
> as opposed to the dynamic context which contains the focus etc.
Ok, I thought you meant another static.
--
Robin Berjon <robin.berjon at expway.fr>
Research Engineer, Expway
7FC0 6F5F D864 EFB8 08CE 8E74 58E6 D5DB 4889 2488
More information about the Xpath-ng
mailing list