# Foundry Coding Style

This document describes the coding conventions for the Foundry theming engine.

## Naming

The naming rules described here apply to all names: Names of layout elements, XSL template names, XSL functions, files, ids and classes (in the `class` attribute).

Use the dash "-" to separate parts of a name instead of camel case or the underscore. For example: `get-setting` instead of `getSetting` or `set_setting`.

Names should be lowercase.

## Namespace declarations

In the XSL files, XML namespaces are only defined at the `<xsl:stylesheet>` element. The XSL namespace is the first one is declared first. The other namespace follow in alphabetic order (ordered by their prefix).

## Indention, line length and formating

Indention is done using spaces. Indention depth is four (4) spaces per level.

Try to keep the line length below 100 characters per line. Because of some restrictions of XML this will be possible in every case.

Insert a line break after each attribute of an XML element. The first attribute is on the same line as the element. For example write

    <xsl:param name=example-param"
               select="'example'"/>

instead of

    <xsl:param name=example-param" select="'example'"/>