This is a follow up to this post. Initially the problem was to store some function's options in some container. Examples of such functions: \includepdf, or \newwatermark. This can be useful if the options are many, and \function[options] is to be used repeatedly. If the options are stored directly in l3seq (first method), it works. But I wanted to store the options in l3prop because it takes care of duplicates (say if I update options at the point of expansion). So, then, an additional step is needed at the point of expansion: transfer the options from l3prop to l3seq and then expand with \seq_use:Nn. This defines the second method. It works for \includepdf, but not \newwatermark. However, Someone pointed out the l3prop method does not preserve the catcode, specifically changes that of the keys to an l3str. The proposed solution (code below) came with this caption: "The first part of that code corresponds to your programmation and the result is FALSE. In the second case, keys are yet strings by construction and the result is TRUE." It identifies where the code fails, but does not solve the problem. Hence the challenge in the subject line: be able to store key-val pairs in l3prop, and be able to recover the catcodes with which they were supplied. In particular, that their expansion work for \newwatermark[options].
PS: someone suggested dropping xwatermark altogether. I pointed out that I ran into problems with background.
\documentclass{article} \begin{document} \ExplSyntaxOn { \seq_set_from_clist:Nn \l_tmpa_seq { key = smth } \prop_set_from_keyval:Nn \l_tmpa_prop { key = smth } \prop_map_inline:Nn \l_tmpa_prop { \seq_put_right:Nn \l_tmpb_seq { #1 = #2 } } \tl_set:Nf \l_tmpa_tl { \seq_use:Nn \l_tmpa_seq { } } \tl_set:Nf \l_tmpb_tl { \seq_use:Nn \l_tmpb_seq { } } \tl_if_eq:NNTF \l_tmpa_tl \l_tmpb_tl { TRUE } { FALSE } % return FALSE } -- { \str_set:Nn \l_tmpa_str { key } \exp_args:NNx \seq_set_from_clist:Nn \l_tmpa_seq { \l_tmpa_str = smth } \exp_args:NNx \prop_set_from_keyval:Nn \l_tmpa_prop { \l_tmpa_str = smth } \prop_map_inline:Nn \l_tmpa_prop { \seq_put_right:Nn \l_tmpb_seq { #1 = #2 } } \tl_set:Nf \l_tmpa_tl { \seq_use:Nn \l_tmpa_seq { } } \tl_set:Nf \l_tmpb_tl { \seq_use:Nn \l_tmpb_seq { } } \tl_if_eq:NNTF \l_tmpa_tl \l_tmpb_tl { TRUE } { FALSE } % return TRUE } \ExplSyntaxOff \end{document}
l3propto achieve this, there is no viable way of storing inside anl3propwithout the stringification, and once a token list has been turned into a string there is no way of knowing the original category codes. What you could do is store inside anl3propboth the name and the value, so something like\prop_put:Nnn \l_tmpa_prop { <name> } { { <name> } { <value> } }. But honestly, I agree with the others who already told you: Dropxwatermark.