An InPlace CMS template is an usual XSLT transformation. There is a lot of resources, both online and offline, to learn XSLT. This page highlights a few patterns.

Identity transformation

The identity template is the starting point for all other templates.

<xsl:stylesheet version="1.0" xmlns:xsl="">
<!-- -->
<xsl:output encoding="ascii" omit-xml-declaration="yes" method="html"/>

<xsl:template match="node()|@*">
    <xsl:apply-templates select="node()|@*"/>


The element xsl:stylesheet and its attributes are the required skeleton of an XSLT stylesheet. The second element, xsl:output, specifies how to serialize the result of transformation.

The only xsl:template matches nodes of a document. A matched node and its attributes are copied to the output tree as is, and template processing is continued for the children.

This XSLT transformation is called “identity template”, as the output document is the same as the input document.

Literal output

To update the div, which has the attribute id set to footer:

<xsl:template match="div[@id='footer']">
  <div id="footer">
    <hr />
    ... more footer goes here ...

Parametric output

To update the div, which has the attribute id set to header, retaining the content of h1:

<xsl:template match="div[@id='header']">
  <div id="header">
    ... your header ...
    <xsl:copy-of select=".//h1"/>
    ... your header continues ...

Structure enchancement

If the stylesheet link is missed, add it.

<xsl:template match="head[not(link[@rel='stylesheet'])]">
    <xsl:copy-of select="node()"/>
    <link rel="stylesheet" href="inplace.css" type="text/css"/>

Comments to tags

It's possible to have implicit markup. Consider the HTML fragment:


On load, this is automatically transformed to such XML:

<InPlaceCMS name="xxx">

On serialization, the reverse transformation occurs.