Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clarify how syntactic shortcut for options are used with non-string option values #161

Open
rdeltour opened this issue May 27, 2015 · 5 comments

Comments

@rdeltour
Copy link

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
Copy link
Author

For a map, am I correct assuming you'd have to use an AVT in this case?

<ex:stepType map-option="{map {
  "Su" : "Sunday",
  "Mo" : "Monday",
  "Tu" : "Tuesday",
  "We" : "Wednesday",
  "Th" : "Thursday",
  "Fr" : "Friday",
  "Sa" : "Saturday"
}}"/>

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
Copy link
Collaborator

ndw commented Jun 6, 2015

You're right, some clarity is required. I think there are two possibilities.

  1. The value of a shortcut attribute is an XPath expression
  2. The value is a string in which AVTs can occur

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
Copy link
Author

rdeltour commented Jun 6, 2015

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 way
  • type coercion is performed to set options of type xs:string, xs:boolean, xs:double, xs:integer, ???

@ndw
Copy link
Collaborator

ndw commented Jun 12, 2015

Proposal:

  1. Curly braces in AVTs atomize and produce strings.
  2. A shortcut option that begins with a single ^ treats the remaining characters in the string as a macro

<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 it opt="^'^'"

@ndw
Copy link
Collaborator

ndw commented Jun 12, 2015

See also #80 for the questions of coercion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants