MURATA Makoto said:
> I do not understand "5.4.6 name element".
>
> First, I am not sure if I understand the following sentence.
>
> The optional path attribute is an expression evaluated in the
> current context that returns a string that is the name of a node.
>
> Does this expression returns a string? If a malicious author creates
> a Schematron schema, the value of the expression is not a node name,
> and few implementations care. In other words, "a string that is the
> name of a node" sounds like a hopeful assumption to me.
But Schematron authors are not malicious! They are all kind, happy,
peaceful people who love their fellow humans. :-)
More seriously, what scenario are you thinking of? Is it where different
groups can send in their own business rules to some common site?
> And what is meant by "the latter case" in the following sentence, which
> follows the above sentence?
>
> In the latter case, the name of the node is used.
Yes, it is not well expressed is it? The first case is when there is no
path attribute; the latter case is when there is a path element.
It would be better as something like this:
"Provides the names of nodes from the instance document to allow clearer
assertions and diagnostics. When no path attribute is specified, the name
is the name of the current context node, if any. If the path attribute is
specified, it contains an expression evaluated in the current context that
evaluates to a string that is the name of the node."
In my beta implementation (soft launched now at www.schematron.com) I use
the function
concat('name(',@path,')')
if the path attribute exists or otherwise just
name(.)
According to the XPath spec s4.1 (http://www.w3.org/TR/xpath), if a node
does not have a local name, an empty string is returned. In other words,
if you use <sch:name/> with no path attribute, it returns an empty string
for comments and PIs without targets only. So I don't see scope for
malice.
So you question relates, I think, to the behaviour of incorrect things like
<sch:name path='1'/>
Where this would expand out to
name('1')
which would be some kind of error. Just as with any other XPath error,
this would generate a run-time failure of the schema.
I suppose I could add some kind of test to the beta implementation to make
sure that @path contained a node: but that would just provide clearer
runtime diagnostics.
Cheers
Rick Jelliffe
-- DSDL members discussion list To unsubscribe, please send a message with the command "unsubscribe" to dsdl-discuss-request@dsdl.org (mailto:dsdl-discuss-request@dsdl.org?Subject=unsubscribe)Received on Sat Jan 20 03:46:20 2007
This archive was generated by hypermail 2.1.8 : Sat Jan 20 2007 - 17:53:06 UTC