Send backlinks back

2012-09-22 21:48

Keywords: footnote, transform, back, link

Another question asked on the forum: how to place Textile-generated footnote backlinks after1 the notes, rather than before?

The solution is quite easy with etc_query: modify your DOM tree. The Textile backlinks are wrapped in sups, and their href starts with #noteref. All we have to do is move the sups at the end of their li parent. Just replace <txp:body /> in the article form by

<txp:etc_query data='<txp:body />'
	replace="//li//a[starts-with(@href,'#noteref')]/../=.." />

An alternative solution is to create a form (say, backlinks)

<txp:etc_query query="ol"
	replace="li//a/../=.."
	data='<txp:yield />' />

and put the footnotes (in the body of the article) inside this form:

<txp:output_form form="backlinks">

notelist:¶.

note#0. A bit of dom modification, and, in the end, the backlink should be at the end.

note#1. And this one escapes from his @sup@ parent and becomes an image.

</txp:output_form>

Naturally, you can transform more than footnotes2 this way, but let us stop here for the moment.


  1. A bit of dom modification, and, in the end, the backlink should be at the end.
  2. And this one escapes from his sup parent and becomes an image.

File(s)