Macro Language Reference > PIs > Formatting Instructions > showifnum
  
showifnum
Description
This command has been implemented primarily with SGML/XML type attributes in mind. <?showifnum> permits the conditional processing of a show string, the condition being the presence of a defined attribute with a numerical value (0-9) on the SGML/XML element. When the specified condition has been met the command will show the value of the attribute.
 
Example 387. Use <?showifnum> command for conditional processing of the date
This is an example of <?showifnum> used to produce different formats of dates. For example, if the tag <date> contains<?showifnum "id" Publication date $^fred#^>, the following references to <date> will give the corresponding output:
<date id=1998>
Output: Publication date 1998
<date id="98 Dec">
Output: Publication date 98 Dec
<date>
Output: (nothing)
<date id="Dec 98">
Output: (nothing)
If the tag <date> contains <?showifnum !"id" Publication date $^fred#^, the following references to <date> will give the corresponding output:
<date id=1998>
Output: (nothing)
<date id="98 Dec">
Output: (nothing)
<date>
Output: Publication date 1998
<date id="Dec 98">
Output: Publication date 98 Dec
Syntax
<?showifnum !:L? name:s showstring:sw>
!
Use the opposite condition: instead of show if defined with a numerical value , use show if name NOT defined or show if value is not numerical.
name
Specify that the name of the attribute for which to test must be present
showstring
Any applicable showstring.
For more information, see Reference Chapter: Showstrings.