On 22/12/24 21:38, Maxime Devos wrote:
Unquote-splicing (,@) is your friend: `(foo ,@(if p? '(a (b) c) '()) d) When p? -> (foo a (b) c d). When (not p?) -> (foo d). Now do this for SXML …
Ah, splicing... yes Maxime, that works :) So I applied it as follows: (define* (special-input #:key name (required? #true)) "Return an SXHTML INPUT element for typing text." `(input (@ (type "text") (name ,name) ,@(if required? '((required "")) '())))) And now converting to XML I get the results I expected: (sxml->xml (special-input #:name "author")) → <input type="text" name="author" required="" /> (sxml->xml (special-input #:name "author" #:required? #false)) → <input type="text" name="author" /> Thank you very much,
OpenPGP_0x0AB0D067012F08C3.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature