I would like to define functions which extract the PDF object number from a PDF object reference, such as 12 from 12 0 R.
I defined two versions of such a function, a low level one and a high level one. The low level function accepts a PDF object reference as a literal string, such as the one given above and extracts the object number 12. This one I got working.
The high level one, however, which accepts a reference as a token list variable unfortunately fails. It should first expand the token list variable and pass it to the low level function. Could someone please find the error in the high level function?
Here is the code I wrote:
\documentclass{article}
\usepackage{expl3}
\begin{document}
\ExplSyntaxOn
\tl_new:Nn\oref{12~0~R} %define some object reference
\cs_new:Npn \lolevel:n #1~0~R {#1}
\cs_new:Nn \hilevel:x {\lolevel:n #1}
Ref:~\oref\par
Num:~\lolevel:n 12~0~R\par %this works!
%Num:~\hilevel:x \oref %doesn't :(
\ExplSyntaxOff
\end{document}
