I've spend a couple of days trying to understand how the pgfkeys work. As an example, I'd like to read a key's value and then use it to set another key.
In this case, I want to set a node's label to the same content as its text:
% attempt 1
\pgfkeys{/tikz/labeltext/.style={label=\pgfkeysvalueof{/tikz/node contents}}}
% attempt 2
\pgfkeys{/tikz/node contents/.store in=\nc}
\pgfkeys{/tikz/labeltext/.style={label=\nc}}
% attempt 3
\pgfkeys{/tikz/labeltext/.code={\pgfkeyssetvalue{\pgfkeysvalueof{/tikz/node contents}}}}
\begin{tikzpicture}
\node [labeltext] {test};
\end{tikzpicture}
What I expect to get is
but nothing happens.