Splitcells Network 's XSL/XML Code Guidelines

These are the guidelines used for XSL code on this site. These represent part of my current understanding of XSL and may be incorrect.

  1.  Patterns and antipatterns in XSLT micropipelining 
  1.  W3C XML Schema: DOs and DON'Ts 

Use attributes only in order state that its content should not be processed by templates. Use explicit elements in the other case. If it makes sense, attributes and values should be supported. If the distinction does not make sense, attributes should not be used or supported. An attribute and its equivalent should not both be present in the same element.

Templates should be applied as late as possible. Example: Inside a template an intermediate element is created and templates are applied to it. Such intermediate elements often contain child elements with additional information. if intermediate elements are created which can be adapted with elements from the inputs

    1. Use intermediate XML document in order to support different types of XML documents for the layout.

Create for each namespace a template that terminates the execution with an error via xsl:message terminate="true" . This way incorrect elements can be detected without any XSD.

 Value-of  extracts the value of the node that is queried by the select attribute.  All elements that are children of the selected node are thereby striped.    Copy-of  creates a copy of the queried node. In general copy-of should be used to generate XML nodes and value-of should be used to generate strings that are not XML nodes.

In order to output objects where all processing is already done, use a template that matches */text()[normalize-space()] . This template should not be called directly. Instead it should be applied implicitly via apply-templates . This ensures ensures that results does not contain any unprocessed values.

    1. normalize-space($variable-name) != ''

    1. normalize-space($variable-name) != ''

Whitespace is best rendered by the non breaking space entity 160 which works for HTML output.

Document that everything is subject, object or predicated. Everything else is just a library of these.


These are the guidelines used for XSL code on this site. These represent part of my current understanding of XSL and may be incorrect.

  1. 's Guidelines
  1. External Guidelines
    1. XSL Guidelines
    2. XSD Guidelines
  2. Design and Architecture
    1. XML Structures
      1. Attributes and Values
    2. Template Application Time
    3. Layout Template Structure
  3. Details of XSLT
    1. value-of , copy-of and $
    2. Check if Variable is set.
    3. * vs. node()
    4. Special Characters
  4. RDF/XML
  1.  Open Tasks 
  1. standard-usage
    1. bash.html
    2. changelog.html
    3. chezmoi.html
    4. commonmark.html
    5. filesystem.html
    6. html.html
    7. java.html
    8. linking.html
    9. maven.html
    10. python.html
    11. shell.html
    12. xml.html
    13. xslt.html
  1. standard-usage
    1. python.html
    2. commonmark.html
    3. xml.html
    4. bash.html
    5. shell.html
    6. java.html
    7. chezmoi.html
    8. filesystem.html
    9. linking.html
    10. changelog.html
    11. maven.html
    12. html.html
    13. xslt.html
    1. d:todo
      1. Avoid using xml attributes and use them only if exact strings are required and no tempaltes should be applied to its value.

    2. d:todo
      1. Minimize abstract syntax tree complexity by avoiding using XML attributes.