First, thanks for the kind words about PXSL.
Second, good question. And, I have the answer you are looking for: Yes, you can do this in stock PXSL. The key is to remember that the <( )> delimiters open a full
pxsl-fragment, which lets you include any number of statements into an argument value. The results of the statements are concatenated to yield the final argument value.
With that in mind, here's one solution:
,command c a1 a2 a3 =
a -href=<( ,c
<<?a1=>>
,a1
<<&a2=>>
,a2
<<&a3=>>
,a3 )> ,BODY,command cmd param1 param2 param3
<<My command link>>which produces the following output when processed with
pxslcc -i:
<a href="cmd?a1=param1&a2=param2&a3=param3">My command link</a>
Strictly speaking, we ought to rewrite the above output so that bare ampersands don't appear in the CDATA value of the
href attribute:
<a href="cmd?a1=param1&a2=param2&a3=param3">My command link</a>
While ampersands are fine in URLs, they ought not to appear unescaped in URLs placed inside of attribute values. Fortunately, we can use PXSL's <{ }> delimiters to take care of the escaping for us automatically.
Also, to make the code's workings a little more obvious, we could factor out the portion that builds the argument body and compact the lines where the arguments' names and values are joined. Thus we end up with the following, final version of our macro:
,command c a1 a2 a3 = a -href=<(,hrefval)>
,BODY # build href value from arguments
,hrefval =
,c
<{?a1=}> ,a1
<{&a2=}> ,a2
<{&a3=}> ,a3