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 viaxsl: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 viaapply-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.

wide screen

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. guidelines
    1. backwards-compatibility.html
    2. changelog.html
    3. chezmoi.html
    4. commonmark.html
    5. complexity-management.html
    6. dependency.html
    7. documentation.html
    8. filesystem.html
    9. gist
      1. git.html
      2. pgp.html
    10. html.html
    11. index.html
    12. infrastructure.html
    13. java.html
    14. licensing.html
    15. linking.html
    16. maven.html
    17. program-code.html
    18. project.html
    19. python.html
    20. shell.html
    21. software-project-file-system-standards.html
    22. software-project-file-system-standards.todo.html
    23. source-code.html
    24. source-types.html
    25. task-management.html
    26. technology-stack.html
    27. test.html
    28. xml.html
    29. xslt.html
  1. guidelines
    1. infrastructure.html
    2. complexity-management.html
    3. test.html
    4. backwards-compatibility.html
    5. java.html
    6. linking.html
    7. changelog.html
    8. commonmark.html
    9. licensing.html
    10. program-code.html
    11. xml.html
    12. technology-stack.html
    13. chezmoi.html
    14. maven.html
    15. project.html
    16. dependency.html
    17. documentation.html
    18. gist
      1. git.html
      2. pgp.html
    19. task-management.html
    20. source-code.html
    21. xslt.html
    22. source-types.html
    23. python.html
    24. shell.html
    25. software-project-file-system-standards.todo.html
    26. index.html
    27. project.partitioning.svg
    28. html.html
    29. filesystem.html
    30. software-project-file-system-standards.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.