- From: Norman Walsh <ndw@nwalsh.com>
- Date: Mon, 27 Apr 2009 07:14:21 -0400
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <m2ab62mjqq.fsf@nwalsh.com>
"Costello, Roger L." <costello@mitre.org> writes:
> Consider the following examples which show the use of the "select"
> and "href" options.
>
> OPTIONS USED AS ATTRIBUTES
>
> This works:
>
> <p:filter select="/BookStore/Book[Date=1998]" />
>
> But this doesn't work:
>
> <p:store href="/Book/Filename" />
That depends what you mean by "work". That will set the href attribute
to "/Book/Filename", literally, not to the result of the XPath expression
/Book/Filename.
> OPTIONS USED AS A CHILD ELEMENT
>
> This works:
>
> <p:store>
> <p:with-option name="href" select="/Book/Filename"/>
> </p:store>
That depends what you mean by "work". That will set the href attribute
to the (string value of the) result of the XPath expression /Book/Filename,
not literally to "/Book/Filename".
> But this doesn't work:
>
> <p:filter>
> <p:with-option name="select" select="/BookStore/Book[Date=1998]" />
> </p:filter>
That should work too. It will set the select option to the string value of
the result of evaluating the XPath expression /BookStore/Book[Date=1998].
If that result isn't a valid XPath expression, you'll get a subsequent
error.
But you probably meant
<p:with-option name="select" select="'/BookStore/Book[Date=1998]'" />
But if you mean that, it's probably simpler to just type
<p:filter select="/BookStore/Book[Date=1998]" />
> Sometimes when an option is used as an attribute it takes an XPath
> expression, sometimes it doesn't. Sometimes when an option is used
> in with-option it takes an XPath expression, sometimes it doesn't.
>
> I'm puzzled.
>
> Would someone explain the rules for using options please?
Using options as attributes is a syntactic shortcut (See 4.8.1). They
always set the option to the literal value specified, if the literal
value is an XPath expression, it *is not* interpreted before setting
the option.
For those options (on those steps) where the *value of the option* is
treated as an XPath expression *by the step*, I can see where some
confusion might arise. I'm open to suggestions about how to reduce
that confusion.
Be seeing you,
norm
--
Norman Walsh <ndw@nwalsh.com> | Doubt is to certainty as neurosis is to
http://nwalsh.com/ | psychosis. The neurotic is in doubt and
| has fears about persons and things; the
| psychotic has convictions and makes
| claims about them. In short, the
| neurotic has problems, the psychotic
| has solutions.--Thomas Szasz
Received on Monday, 27 April 2009 11:15:02 UTC