xproc / 1.0-specification

The 1.0 XProc specification and now abandoned drafts of a 2.0 XML specification
12 stars 6 forks source link

consider making the match attribute default to '/*' for p:add-attribute etc. #160

Open gimsieke opened 9 years ago

gimsieke commented 9 years ago

In 1.0, only p:insert has a default of '/' for the match attribute, and p:label-elements defaults to . For most other steps with a match option, this option is required and does not have a default value. I find myself using match="/" most of the time, at least with p:add-attribute. Will it harm to make match default to '/' for p:add-attribute and several other steps listed below? The reason is: it reduces verbosity (a bit) without introducing too much arcane magic.

step currently has default? proposed default
p:add-attribute no *'/'**
p:delete no pobably none
p:hash no *'/'** (unless p:hash gets a select option that allows hashing string values calculated from the select expression)
p:insert yes '/*'
p:label-elements yes '*'
p:make-absolute-uris no probably none
p:rename no *'/'** (not sure about this)
p:replace no probably none
p:set-attributes no *'/'**
p:string-replace no *'/'**
p:unwrap no *'/'**
p:uuid no *'/'**
p:wrap no / (not sure about this)
p:www-form-urlencode no probably none

Proposed changes are boldface.

josteinaj commented 9 years ago

Would be great to have more defaults. Definitely /* for p:add-attribute, p:rename and p:unwrap (as you suggest).

For p:string-replace though /* will basically always result in a XD0001 error. Something like /*/text() would be more useful for the simple cases.