The XSL wrapper tags are used to render the contents faithfully in CMS. All wrapper tags used as selectors in the css charter are copied into this file, so that the HTML code used to display content alone in CMS has a structure similar to that of a page template. This XSL file therefore includes all the imports, parameters and templates present in a template, as well as the HTML tags used to display the page core. The header banner, footer, navigation menu and other elements making up the page should not be included in this XSL.
This XSL wrapper is placed in the charter tree in skins/[skinName]/stylesheets/content/_wrapper/ . It is named content.xsl for all content types used on the site.
If required, it is possible to define a XSL wrapper by content type, as is generally the case for the XSL wrapper for the newsletter, which is rarely presented as a site page. In this case, it is named content-org.ametys.plugins.newsletter.Content.newsletter.xsl i.e. content-[idPlugin].xsl
Oops! Copy to clipboard failed. Open the code and copy it manually.<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:sitemap="http://www.ametys.org/inputdata/sitemap/3.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:ametys="org.ametys.web.transformation.xslt.AmetysXSLTHelper"
xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date"
exclude-result-prefixes="sitemap ametys">
<xsl:import href="workspace:web://stylesheets/template-default.xsl"/>
<xsl:import href="plugin:cms://stylesheets/helper/html-hierarchy.xsl"/>
<xsl:variable name="contextPath" select="ametys:uriPrefix()"/>
<xsl:variable name="uri-prefix" select="ametys:uriPrefix()"/>
<xsl:variable name="skin" select="ametys:skin()"/>
<xsl:variable name="siteName" select="ametys:site()"/>
<xsl:variable name="lang" select="ametys:lang()"/>
<xsl:template match="/">
<html>
<head>
<xsl:copy-of select="/html/head/*[local-name()!='title']"/>
</head>
<body>
<div class="wrapper">
<div class="main-content">
<xsl:apply-templates select="html/body/node()" mode="move-hierarchy">
<xsl:with-param name="level" select="2"/>
</xsl:apply-templates>
</div>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:sitemap="http://www.ametys.org/inputdata/sitemap/3.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:ametys="org.ametys.web.transformation.xslt.AmetysXSLTHelper"
xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date"
exclude-result-prefixes="sitemap ametys">
<xsl:import href="workspace:web://stylesheets/template-default.xsl"/>
<xsl:import href="plugin:cms://stylesheets/helper/html-hierarchy.xsl"/>
<xsl:variable name="contextPath" select="ametys:uriPrefix()"/>
<xsl:variable name="uri-prefix" select="ametys:uriPrefix()"/>
<xsl:variable name="skin" select="ametys:skin()"/>
<xsl:variable name="siteName" select="ametys:site()"/>
<xsl:variable name="lang" select="ametys:lang()"/>
<xsl:template match="/">
<html>
<head>
<xsl:copy-of select="/html/head/*[local-name()!='title']"/>
</head>
<body>
<div class="wrapper">
<div class="main-content">
<xsl:apply-templates select="html/body/node()" mode="move-hierarchy">
<xsl:with-param name="level" select="2"/>
</xsl:apply-templates>
</div>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Voir le code
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:sitemap="http://www.ametys.org/inputdata/sitemap/3.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:ametys="org.ametys.web.transformation.xslt.AmetysXSLTHelper"
xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date"
exclude-result-prefixes="sitemap ametys">
<xsl:import href="workspace:web://stylesheets/template-default.xsl"/>
<xsl:import href="plugin:cms://stylesheets/helper/html-hierarchy.xsl"/>
<xsl:variable name="contextPath" select="ametys:uriPrefix()"/>
<xsl:variable name="uri-prefix" select="ametys:uriPrefix()"/>
<xsl:variable name="skin" select="ametys:skin()"/>
<xsl:variable name="siteName" select="ametys:site()"/>
<xsl:variable name="lang" select="ametys:lang()"/>
<xsl:template match="/">
<html>
<head>
<xsl:copy-of select="/html/head/*[local-name()!='title']"/>
</head>
<body>
<div class="wrapper">
<div class="main-content">
<xsl:apply-templates select="html/body/node()" mode="move-hierarchy">
<xsl:with-param name="level" select="2"/>
</xsl:apply-templates>
</div>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Noter que le mode move-hierarchy permet de définir le premier niveau de titre du contenu. Dans cet exemple, sur le premier titre sera appliqué une balise <h2>