This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [Stylesheets] Adding a text the *first* time yo uencounter a given element?


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:bortzmeyer@nic.fr]
Sent: Wednesday, February 12, 2003 10:22 AM
To: docbook-apps@lists.oasis-open.org
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}}%
   {}%
}%
{}%	
}




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]