RE: [xsl] Footnotes, for a learner.

Subject: RE: [xsl] Footnotes, for a learner.
From: "Max Dunn" <maxdunn@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 1 Jan 2002 18:03:29 -0800
There are many ways you can do footnotes, how you would do the transform
would depend on how you are maintaining the footnotes in your XML.
here's one very simple example:

================ zine.xml ================

<?xml version="1.0"?>
<?xml-stylesheet href="zine.xsl" type="text/xsl"?>
<Zine>
	<Para>This zine is about Egyptology<footnote>I don't really 
	know anything about Egyptology, but I thought I'd learn by 
	writing about it, if you want a serious book there's a good 
	one by Jean Vercoutter.</footnote>  Egyptology is the study
	of the culture and artifacts of the ancient Egyptian 
	civilization.
	</Para>
	<Para>
	Between approximately 7000 and 2000 BC Egyptian culture 
	flourished<footnote>Of course some would argue that it didn't
	flourish, as for example there was slavery, women were treated
	like cattle, and certainly not all Egyptians were happy: in any
	case, at a minimum, they flourished in the sense of churning 
	out marvels of technological innovation.</footnote>: reminders
	such as the pyramids survive to this day.
	</Para>
</Zine>	

=============== zine.xsl ==================

<?xml version="1.0"?><!--zine.xsl-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
  <html>
  <head>
	</head>
	<body>	
	<xsl:apply-templates/>
	<br /><hr />
	<xsl:apply-templates select="//footnote" mode="endlist"/>
	</body>
  </html>
</xsl:template>

<xsl:template match="Para">
	<p>
	<xsl:apply-templates mode="default"/>
	</p>
</xsl:template>

<xsl:template match="footnote" mode="default">
	<xsl:variable name="inc">
		<xsl:number level="any" count="footnote"/>
	</xsl:variable>			
	<sup>&#xa0;<a href="#{$inc}" name="f{$inc}">
	<xsl:value-of select="$inc"/></a></sup>
</xsl:template>

<xsl:template match="footnote" mode="endlist">
	<p>
	<xsl:variable name="incr">
		<xsl:number level="any" count="footnote"/>
	</xsl:variable>		
	<a name="{$incr}">
	<sup><xsl:value-of select="$incr"/></sup>
	</a>
	&#xa0;
	<xsl:value-of select="."/>
	<xsl:text> </xsl:text>
	<a href="#f{$incr}">back</a>
	</p>
</xsl:template>	

</xsl:stylesheet>


HTH,
Max

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Michel Guay
Sent: Tuesday, January 01, 2002 5:27 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Footnotes, for a learner.




Hi !

First, note that my knowledge of xslt is thin. And I am far from being a

programmer like all of you. I am learning by doing. Then, please
apologize 
if my question seems basic or primitive.

Presently, I am developping a model in xml / xslt for a e-zine in 
Egyptology. All goes well, using books and informations found on the
web. 
But I have a problem : I want to insert footnotes in the articles. Using
M. 
Kay?s book, I am able to generate the footnotes at the end of the
article. 
But, I really can?t build the hyperlinks between the notes number (in
the 
text) and the specific footnote placed at the end of the article (the 
anchor in html).

My wish (for the New Year) : to find a good working exemple so that I
can 
learn and understand how things work (in the xml document and in the
xslt 
stylesheet).

I would appreciate a suggestion or two. Maybe a link somewhre (yes, I
want 
through the Archive, but I have only found partial info).

Thanks and Happy New Years.

Michel Guay
Historian.
Université du Québec.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread