Modify XHTML generated for the content

By default, Ametys (and any optional plugin) creates the HTML for the content that are rendered in your templates.
Your only option to change the look is to use CSS.
This is a power way to customize your appareance but that only match 95% of the cases.

The last 5% need to modify the HTML generated.

To do so, go in the file "stylesheets/io/docbook2htmleditor.xsl".
This file is empty by default, but you can override some default behaviore

In this file, you can override one of the default behaviors by adding a matcher on a specific docbook tag.
As your XSL will be merged to the kernel ones, you have to ensure that your template is prioritary.

Sample on title hierarchy

The default behavior is to convert "title 1" to "h3".
This is done in the kernel file "plugins/cms/stylesheets/docbook2html.xsl"

    <xsl:template match="docbook:article">
            <xsl:with-param name="level" select="3"/>

If in you skin you have a level of hierarchy that is different, you can override this point this way (in you own skin) :

    <xsl:template match="docbook:article" priority="10">
            <xsl:with-param name="level" select="4"/>

This sample now convert "title 1" to <h4>

How to have a specific behavior in a template ?

You can go deeper and have a specific behavior in your templates.
To do so, put a default file "docbook2htmleditor.xsl" in each template and add the following instruction in the main file "stylesheets/io/docbook2htmleditor.xsl".

     <xsl:import href="template://docbook2htmleditor.xsl"/>
This will make the main file to delegate to the current template file.

Back to top