![](https://secure.gravatar.com/avatar/d0e94fb08d4620cfbd2f8f59a7868637.jpg?s=120&d=mm&r=g)
Hi gurus, sorry for this long mail, but this is too difficult for me, and I have to apologize that I can't provide a minimal example. Here's what I want: I have one big xml-file which is my lecture course for the semester. Every single lecture is one section. This xml-file is processed (needless to say!) with ConTeXt. Every lecture is accompanied by a presentation, written in and processed by ConTeXt. The TeX files and the resulting pdfs are named by their dates, such as 07_11_23.pdf for today's lecture. I have defined a simple counter that will typeset a number in red at every place in the lecture where I show a new slide (and then increment the counter); here are the relevant definitions: \definelabel[SlideNumber][headstyle=normal,way=bytext] \define\SLN{\color[red]{[\nextSlideNumber]}} \defineXMLcommand[sln]{\sln} What I want: I would like to produce a "handout" of the lecture course which would include the slides at the relevant places. My idea was that everything is basically in place. I would simply need to define a "handout" mode which would redefine this \sln command and use the SlideNumber counter to insert the relevant pages from the presentation pdf. But I can't get it to work. Here's what I've tried: 1. the value of the \SlideNumber counter should be \currentSlideNumber, so basically I would like something along these lines: \define\sln {\externalfigure[presentations/07_11_23.pdf][page= \currentSlideNumber]\incrementSlideNumber} But this throws an error: ! Argument of \pp!doifinstringelse has an extra }. <inserted text> \par <to be read again> } \doif #1#2->\edef \!!stringa {#1} \edef \!!stringb {#2}\ifx \!!stringa \!!str... \checkfigureusersettings ...ntedfigurepage \empty {\let \wantedfigurepage \!... \calculateexternalfigure ...eckfigureusersettings \checkfigurecolorsettings ... <argument> ...lideNumber },width=.75\textwidth ][] \calculateexternalscreenfi... ... l.71 <SLN/> I assume it is an expansion problem. I tried page= \expanded{\currentSlideNumber]}, but that doesn't work either. So this is my first problem: how can I pass the value of SlideNumber on to the externalfigure command? 2. Next step: I would like to have the name of the corresponding presentation pdf in another macro so I can include this in the command definition as well. In TeX, I would simply write someting like \let\CurrentPresentation=07_11_23.pdf into my file and then refer to \CurrentPresentation. But how do I do this in XML? I was thinking something along the lines <section Current="07_11_23.pdf"> but am at a loss as to how to pick up this value later. Sorry for the long post; I'd be very happy if someone could provide some insights. Thomas