You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
clarify how syntactic shortcut for options are used with non-string option values
This is an aggregation of the discussion on "clarify how syntactic shortcut for options are used with non-string option values" (Issue 161 of the xproc/1.0-specification)
Opened by: rdeltour on 2015-05-27, 16:12h
rdeltour said on 2015-05-27, 16:12h:
Section 4.8.1 Syntactic shortcut for options seems clear enough for atomic types, at leastxs:string, but it's unclear how to define more exoticly-typed options, like maps.
But for "castable" option value, e.g.xs:integers, is the following possible?
<ex:stepType int-option="1"/>
Or should it be interpreted as "a non-string value can only be set with AVT"?
ndw said on 2015-06-06, 10:17h:
You're right, some clarity is required. I think there are two possibilities.
I have a slight preference for the former, but in the interest of backwards compatibility (and compatibility with attribute values on other elements), I think we should probably do the latter.
rdeltour said on 2015-06-06, 11:51h:
Backwards compatibility is a compelling argument, so let's assume the value is a string. The next thing to clarify is whether any kind of type coercion is performed by the processor. For this latter, again two possibilities:
only xs:stringoptions can be set that way
type coercion is performed to set options of type xs:string, xs:boolean, xs:double, xs:integer, ???
ndw said on 2015-06-12, 10:37h:
Proposal:
<ex:step opt="3">
Sets opt = string value 3.
<ex:step opt="^3">
Sets opt = integer value 3 (or decimal or whatever XPath does with the expression 3)
<ex:step opt='^map{"one": 1, "two": 2}'>
Sets opt = a map with two keys.
Yes, we're inventing a new escaping mechanism.
P.S. If you want a literal ^, you have to escape itopt="^'^'"
On 2015-06-12, 10:37h: ndw added the proposed-resolution label.
Doesn't seem to be an issue here. The value of the AVT is the value of the option. If the option specifies a type (using as=), the value is cast to that type, which either succeeds or fails.
clarify how syntactic shortcut for options are used with non-string option values
Opened by: rdeltour on 2015-05-27, 16:12h
rdeltour said on 2015-05-27, 16:12h:
Section 4.8.1 Syntactic shortcut for options seems clear enough for atomic types, at least
xs:string
, but it's unclear how to define more exoticly-typed options, like maps.See also#146.
rdeltour said on 2015-05-27, 16:25h:
For a map, am I correct assuming you'd have to use an AVT in this case?
But for "castable" option value, e.g.
xs:integers
, is the following possible?Or should it be interpreted as "a non-string value can only be set with AVT"?
ndw said on 2015-06-06, 10:17h:
You're right, some clarity is required. I think there are two possibilities.
I have a slight preference for the former, but in the interest of backwards compatibility (and compatibility with attribute values on other elements), I think we should probably do the latter.
rdeltour said on 2015-06-06, 11:51h:
Backwards compatibility is a compelling argument, so let's assume the value is a string. The next thing to clarify is whether any kind of type coercion is performed by the processor. For this latter, again two possibilities:
only
xs:string
options can be set that waytype coercion is performed to set options of type
xs:string
,xs:boolean
,xs:double
,xs:integer
, ???ndw said on 2015-06-12, 10:37h:
Proposal:
<ex:step opt="3">
Sets opt = string value 3.
<ex:step opt="^3">
Sets opt = integer value 3 (or decimal or whatever XPath does with the expression 3)
<ex:step opt='^map{"one": 1, "two": 2}'>
Sets opt = a map with two keys.
Yes, we're inventing a new escaping mechanism.
P.S. If you want a literal
^
, you have to escape itopt="^'^'"
ndw said on 2015-06-12, 11:13h:
See also #80 for the questions of coercion.
The text was updated successfully, but these errors were encountered: