Try using 
<xsl:template match="//rfc[1]">
 <!-- Add link to RFC here -->
</xsl:template>

I'm not totally sure this will work, but I think since the match is on the
/descendant-or-self axis of the root node, this will only match on the first
rfc element in the document.

Jeff
-----Original Message-----
From: Stephane Bortzmeyer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 12, 2003 10:22 AM
To: [EMAIL PROTECTED]
Subject: DOCBOOK-APPS: [Stylesheets] Adding a text the *first* time you
encounter a given element?


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}}%
   {}%
}%
{}%     
}



Reply via email to