This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
[Stylesheets] Adding a text the *first* time youencounter a given element?
- From: Stephane Bortzmeyer <bortzmeyer at nic dot fr>
- To: docbook-apps at lists dot oasis-open dot org
- Date: Wed, 12 Feb 2003 16:22:00 +0100
- Subject: DOCBOOK-APPS: [Stylesheets] Adding a text the *first* time youencounter a given element?
- Organization: NIC France
I have a custom element <rfc> to put references to RFC. I want to add
a small blurb explaining how to get a RFC but, since there are many
references to RFC in a given text, I want it to appear only the first
time.
I have no idea on how to do that. Both XSL and DSSSL are stateless so
I cannot keep a "already_seen" variable.
To make things more concrete, here is the way I do it in LaTeX:
% The first time we mention a RFC, add a reference
\newcounter{rfcfirst}
\newcommand{\rfc}[1]{RFC #1\ifthenelse{\boolean{rfcfootnote}}%
{\ifthenelse{\value{rfcfirst} = 0}%
{\footnote{Pour voir le RFC de numéro NNN,
\url{http://www.ietf.org/rfc/rfcNNN.txt}, par exemple
\url{http://www.ietf.org/rfc/rfc#1.txt}}\stepcounter{rfcfirst}}%
{}%
}%
{}%
}