I have (TEI)XML with bits like
<ref target="#a1"/> but also <ref target="#a1 #b2 #c3"/>
I need to write the xquery code to transform each #-target to a link; this is no problem if I have just one target="#a1", then I use substring-after($node/@target, '#') and look for xml-ids that are the same as the substring, but then of course I get problems if the substring is longer than needed, no match is possible.
Is there a way to select the substring between # and space or # and "?
(I am very new to xquery so sorry if I am asking something very obvious, but I could not find an economic solution)