Hello,
I’m having trouble replicating your example, what version of Scala and which libraries are you using ?
In general I would advise against using XML litterals, as they are slowly being deprecated.
There are now string interpolators which are a more general way of doing these kinds of embedded language operations:
They also do support pattern matching (but this is only documented in its SIP …)
And in particular there are these library-defined string interpolators for XML (which I have not tested, and am not sure are still maintained):
(see also Scala 3 xml string interpolator)
Personally I think more should be done to ensure we have a suitable replacement to XML literals