ref-

To reduce conflicts, we deal with labels indirectly through a counter. The counter is increased before \getlabel and after ref. That is, this pair is assured consistency of a label. The separation between \GetLabel and \PutLabel is to allow the latter one into immediate arguments such as \HCode and \Tg.

\label sends its info to \getlabel. It insert a ‘<pageref name="#1">’ iff it is a target of a \pageref.

\:info{\string\Configure{label}{\string#1}{\string#1}} 
\:info{\string\Configure{pageref}{\string#1}} 
\:info{\string\Configure{ref}{\string#1}} 
 
 
 
\Configure{label}{#1}{\HCode{[pagelabel label="#1"/]}} 
\Configure{pageref}{\HCode{[pageref label="#1"/]}} 
\Configure{ref}{\HCode{[ref label="#1"/]}} 
\GetLabel \PutLabel  \ref{a}  \pageref{a}  \label{a}