Search

Hi, I’m new to Symphony and XSLT. I’ve been playing with Symphony for a couple of days now, and I’m wondering if I can have XSLT automatically generate a list of footnotes at the bottom of a page.

I tried using a element in the XSL file of the page, like so:

<p>
    Some text here.
    <footnote>Hello world, I am a footnote.</footnote>
</p>

Then I put this in the appropriate spot of my master XSL template:

<xsl:apply-templates select="//footnote" mode="footnote">

At the bottom, I put a corresponding template that matched “//footnote”.

The problem appears to be that, because the element is in the XSL file and not in the source XML, it’s not being matched. Is this correct? If so, am I going about this completely the wrong way?

Can you show us an example of your XML output and your XSL template?

the element is in the XSL file and not in the source XML, it’s not being matched. Is this correct?

That sounds about right.

You would need to add the footnotes into one of your data sources for the page, and you would then be able to reference them with XPATH like you have tried to do.

Alternatively, if your footnotes are static, you can just put the markup in the footer in the first place.

The page itself is static; all of its content at the moment is in the XSL template: http://pastie.org/948728

And this is the global template: http://pastie.org/948727

You would need to add the footnotes into one of your data sources for the page, and you would then be able to reference them with XPATH like you have tried to do.

I would like to generate the list of footnotes dynamically, even though the page itself is static, since it would be a headache to have to adjust every footnote each time I removed or added one.

Since the page content isn’t being pulled from a data source, however, how do I add the footnotes in the XSL template to a data source?

I second Rob on this one, if they’re static then you will need to place them in the xsl where you want them to appear in the output.

To do what you want using the footnote node, they’re going to have to be pulled from the datasource xml. The xsl for this method is slightly out too

<xsl:template match="//footnote" mode="footnote">

needs to be

<xsl:template match="footnote" mode="footnote">

If you’re wanting static content, it would be much easier to have a Static Section, so that you can maintain the content more easily from the gui rather than having to edit templates. That way, you could use the xsl to find your footnote node, from datasource xml, and still have it static.

You could create a simple static data source, and hand-write the content and footnotes into that, or create a section for your page content as @designermonkey suggested.

Either way, I don’t believe you can do what you want by having the footnotes in the XSL stylesheet.

But in terms of the XPATH to reference the footnotes and stick them into the footer, that should be straightforward once they are coming from a DS.

One thing I’m looking into doing is using Nils’ Subsection Manager as a footnote manager for a client of mine. The idea being he would enter in preset information, probably just a text box, and then drag and drop it into the text as necessary. Then, through XSLT I would auto-format it to be a footnote link for the footnote at the bottom of the article. Then, again with XSLT, I would add the footnotes in the bottom with ID’s so you could hash-link to them.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details