Section 48.1 Author and Publisher Input
When an author or publisher provides input to regulate some change in how their content is realized follow these procedures.
- String parameters (which are discouraged anyway) should default to an empty string initially when defined. For technical reasons, this makes them easier to deprecate later.
- Input should produce a global variable, whose possible values are known exactly. This variable should be set in one location, with other similar variables, and then it should be used later. There should be no need to further error-check this variable later. In other words, do not mix error-checking input and employment of that input—rigorously separate them (like separating content from presentation!).
- Use a
<xsl:variable>that first parrots legitimate input. Next check for attempts to set the input to something “invalid”. Use
- the name of the input being checked
- a description of valid values
- “, not” followed by the invalid value supplied (via
- “Using the default value”, followed by that value
- Then don’t forget to actually set the default value, either due to no input, or erroneous input.
- Done right, this variable will usually meet the requirements above.
- If input is binary, have the variable just described take on one of two values. Only. Then construct a new boolean variable based on these two strings. Name the variable with a
b-prefix. This will be more reliable to use later.