[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157]
[0158]
[0159]
[0160]
[0161]
[0162]
[0163]
[0164]
[0165]
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175]
[0176]
[0177]
[0178]
[0179]
[0180]
[0181]
[0182]
[0183]
[0184]
[0185]
[0186]
[0187]
[0188]
[0189]
[0190]
[0191]
[0192]
[0193]
[0194]
[0195]
[0196]
[0197]
[0198]
[0199]
[0200]
[0201]
[0202]
[0203]
[0204]
[0205]
[0206]
[0207]
[0208]
[0209]
[0210]
[0211]
[0212]
[0213]
[0214]
[0215]
[0216]
[0217]
[0218]
[0219]
[0220]
[0221]
[0222]
[0223]
[0224]
[0225]
[0226]
[0227]
[0228]
[0229]
[0230]
[0231]
[0232]
[0233]
[0234]
[0235]
[0236]
[0237]
[0238]
[0239]
[0240]
[0241]
[0242]
[0243]
[0244]
[0245]
[0246]
[0247]
[0248]
[0249]
[0250]
[0251]
[0252]
[0253]
[0254]
[0255]
[0256]
[0257]
[0258]
[0259]
[0260]
[0261]
[0262]
[0263]
[0264]
[0265]
[0266]
[0267]
[0268]
[0269]
[0270]
[0271]
[0272]
[0273]
[0274]
[0275]
[0276]
[0277]
[0278]
[0279]
[0280]
[0281]
[0282]
[0283]
[0284]
[0285]
[0286]
[0287]
[0288]
[0289]
[0290]
[0291]
[0292]
[0293]
[0294]
[0295]
[0296]
[0297]
[0298]
[0299]
[0300]
[0301]
[0302]
[0303]
[0304]
[0305]
[0306]
[0307]
[0308]
[0309]
[0310]
[0311]
[0312]
[0313]
[0314]
[0315]
[0316]
[0317]
[0318]
[0319]
[0320]
[0321]
[0322]
[0323]
[0324]
[0325]
[0326]
[0327]
[0328]
[0329]
[0330]
[0331]
[0332]
[0333]
[0334]
[0335]
[0336]
[0337]
[0338]
[0339]
[0340]
[0341]
[0342]
[0343]
[0344]
[0345]
[0346]
[0347]
[0348]
[0349]
[0350]
[0351]
[0352]
[0353]
[0354]
[0355]
[0356]
[0357]
[0358]
[0359]
[0360]
[0361]
[0362]
[0363]
[0364]
[0365]
[0366]
[0367]
[0368]
[0369]
[0370]
[0371]
[0372]
[0373]
[0374]
[0375]
[0376]
[0377]
[0378]
[0379]
[0380]
[0381]
[0382]
[0383]
[0384]
[0385]
[0386]
[0387]
[0388]
[0389]
[0390]
[0391]
[0392]
[0393]
[0394]
[0395]
[0396]
[0397]
[0398]
[0399]
[0400]
[0401]
[0402]
[0403]
[0404]
[0405]
[0406]
[0407]
[0408]
[0409]
[0410]
[0411]
[0412]
[0413]
[0414]
[0415]
[0416]
[0417]
[0418]
[0419]
[0420]
[0421]
[0422]
[0423]
[0424]
[0425]
[0426]
[0427]
[0428]
[0429]
[0430]
[0431]
[0432]
[0433]
[0434]
[0435]
[0436]
[0437]
[0438]
[0439]
[0440]
[0441]
[0442]
[0443]
[0444]
[0445]
[0446]
[0447]
[0448]
[0449]
[0450]
[0451]
[0452]
[0453]
[0454]
[0455]
[0456]
[0457]
[0458]
[0459]
[0460]
[0461]
[0462]
[0463]
[0464]
[0465]
[0466]
[0467]
[0468]
[0469]
[0470]
[0471]
[0472]
[0473]
[0474]
[0475]
[0476]
[0477]
[0478]
[0479]
[0480]
[0481]
[0482]
[0483]
[0484]
[0485]
[0486]
[0487]
[0488]
[0489]
[0490]
[0491]
[0492]
[0493]
[0494]
[0495]
[0496]
[0497]
[0498]
[0499]
[0500]
[0501]
[0502]
[0503]
[0504]
[0505]
[0506]
[0507]
[0508]
[0509]
[0510]
[0511]
[0512]
[0513]
[0514]
[0515]
[0516]
[0517]
[0518]
[0519]
[0520]
[0521]
[0522]
[0523]
[0524]
[0525]
[0526]
[0527]
[0528]
[0529]
[0530]
[0531]
[0532]
[0533]
[0534]
[0535]
[0536]
[0537]
[0538]
[0539]
[0540]
[0541]
[0542]
[0543]
[0544]
[0545]
[0546]
[0547]
[0548]
[0549]
[0550]
[0551]
[0552]
[0553]
[0554]
[0555]
[0556]
[0557]
[0558]
[0559]
[0560]
[0561]
[0562]
[0563]
[0564]
[0565]
[0566]
[0567]
[0568]
[0569]
[0570]
[0571]
[0572]
[0573]
[0574]
[0575]
[0576]
[0577]
[0578]
[0579]
[0580]
[0581]
[0582]
[0583]
[0584]
[0585]
[0586]
[0587]
[0588]
[0589]
[0590]
[0591]
[0592]
[0593]
[0594]
[0595]
[0596]
[0597]
[0598]
[0599]
[0600]
[0601]
[0602]
[0603]
[0604]
[0605]
[0606]
[0607]
[0608]
[0609]
[0610]
[0611]
[0612]
[0613]
[0614]
[0615]
[0616]
[0617]
[0618]
[0619]
[0620]
[0621]
[0622]
[0623]
[0624]
[0625]
[0626]
[0627]
[0628]
[0629]
[0630]
[0631]
[0632]
[0633]
[0634]
[0635]
[0636]
[0637]
[0638]
[0639]
[0640]
[0641]
[0642]
[0643]
[0644]
[0645]
[0646]
[0647]
[0648]
[0649]
[0650]
[0651]
[0652]
[0653]
[0654]
[0655]
[0656]
[0657]
[0658]
[0659]
[0660]
[0661]
[0662]
[0663]
[0664]
[0665]
[0666]
[0667]
[0668]
[0669]
[0670]
[0671]
[0672]
[0673]
[0674]
[0675]
[0676]
[0677]
[0678]
[0679]
[0680]
[0681]
[0682]
[0683]
[0684]
[0685]
[0686]
[0687]
[0688]
[0689]
[0690]
[0691]
[0692]
[0693]
[0694]
[0695]
[0696]
[0697]
[0698]
[0699]
[0700]
[0701]
[0702]
[0703]
[0704]
[0705]
[0706]
[0707]
[0708]
[0709]
[0710]
[0711]
[0712]
[0713]
[0714]
[0715]
[0716]
[0717]
[0718]
[0719]
[0720]
[0721]
[0722]
[0723]
[0724]
[0725]
[0726]
[0727]
[0728]
[0729]
[0730]
[0731]
[0732]
[0733]
[0734]
[0735]
[0736]
[0737]
[0738]
[0739]
[0740]
[0741]
[0742]
[0743]
[0744]
[0745]
[0746]
[0747]
[0748]
[0749]
[0750]
[0751]
[0752]
[0753]
[0754]
[0755]
[0756]
[0757]
[0758]
[0759]
[0760]
[0761]
[0762]
[0763]
[0764]
[0765]
[0766]
[0767]
[0768]
[0769]
[0770]
[0771]
[0772]
[0773]
[0774]
[0775]
[0776]
[0777]
[0778]
[0779]
[0780]
[0781]
[0782]
[0783]
[0784]
[0785]
[0786]
[0787]
[0788]
[0789]
[0790]
[0791]
[0792]
[0793]
[0794]
[0795]
[0796]
[0797]
[0798]
[0799]
[0800]
[0801]
[0802]
[0803]
[0804]
[0805]
[0806]
[0807]
[0808]
[0809]
[0810]
[0811]
[0812]
[0813]
[0814]
[0815]
[0816]
[0817]
[0818]
[0819]
[0820]
[0821]
[0822]
[0823]
[0824]
[0825]
[0826]
[0827]
[0828]
[0829]
[0830]
[0831]
[0832]
[0833]
[0834]
[0835]
[0836]
[0837]
[0838]
[0839]
[0840]
[0841]
[0842]
[0843]
[0844]
[0845]
[0846]
[0847]
[0848]
[0849]
[0850]
[0851]
[0852]
[0853]
[0854]
[0855]
[0856]
[0857]
[0858]
[0859]
[0860]
[0861]
[0862]
[0863]
[0864]
[0865]
[0866]
[0867]
[0868]
[0869]
[0870]
[0871]
[0872]
[0873]
[0874]
[0875]
[0876]
[0877]
[0878]
[0879]
[0880]
[0881]
[0882]
[0883]
[0884]
[0885]
[0886]
[0887]
[0888]
[0889]
[0890]
[0891]
[0892]
[0893]
[0894]
[0895]
[0896]
[0897]
[0898]
[0899]
[0900]
[0901]
[0902]
[0903]
[0904]
[0905]
[0906]
[0907]
[0908]
[0909]
[0910]
[0911]
[0912]
[0913]
[0914]
[0915]
[0916]
[0917]
[0918]
[0919]
[0920]
[0921]
[0922]
[0923]
[0924]
[0925]
[0926]
[0927]
[0928]
[0929]
[0930]
[0931]
[0932]
[0933]
[0934]
[0935]
[0936]
[0937]
[0938]
[0939]
[0940]
[0941]
[0942]
[0943]
[0944]
[0945]
[0946]
[0947]
[0948]
[0949]
[0950]
[0951]
[0952]
[0953]
[0954]
[0955]
[0956]
[0957]
[0958]
[0959]
[0960]
[0961]
[0962]
[0963]
[0964]
[0965]
[0966]
[0967]
[0968]
[0969]
[0970]
[0971]
[0972]
[0973]
[0974]
[0975]
[0976]
[0977]
[0978]
[0979]
[0980]
[0981]
[0982]
[0983]
[0984]
[0985]
[0986]
[0987]
[0988]
[0989]
[0990]
[0991]
[0992]
[0993]
[0994]
[0995]
[0996]
[0997]
[0998]
[0999]
[1000]
[1001]
[1002]
[1003]
[1004]
[1005]
[1006]
[1007]
[1008]
[1009]
[1010]
[1011]
[1012]
[1013]
[1014]
[1015]
[1016]
[1017]
[1018]
[1019]
[1020]
[1021]
[1022]
[1023]
[1024]
[1025]
[1026]
[1027]
[1028]
[1029]
[1030]
[1031]
[1032]
[1033]
[1034]
[1035]
[1036]
[1037]
[1038]
[1039]
[1040]
[1041]
[1042]
[1043]
[1044]
[1045]
[1046]
[1047]
[1048]
[1049]
[1050]
[1051]
[1052]
[1053]
[1054]
[1055]
[1056]
[1057]
[1058]
[1059]
[1060]
[1061]
[1062]
[1063]
[1064]
[1065]
[1066]
[1067]
[1068]
[1069]
[1070]
[1071]
[1072]
[1073]
[1074]
[1075]
[1076]
[1077]
[1078]
[1079]
[1080]
[1081]
[1082]
[1083]
[1084]
[1085]
[1086]
[1087]
[1088]
[1089]
[1090]
[1091]
[1092]
[1093]
[1094]
[1095]
[1096]
[1097]
[1098]
[1099]
[1100]
[1101]
[1102]
[1103]
[1104]
[1105]
[1106]
[1107]
[1108]
[1109]
[1110]
[1111]
[1112]
[1113]
[1114]
[1115]
[1116]
[1117]
[1118]
[1119]
[1120]
[1121]
[1122]
[1123]
[1124]
[1125]
[1126]
[1127]
[1128]
[1129]
[1130]
[1131]
[1132]
[1133]
[1134]
[1135]
[1136]
[1137]
[1138]
[1139]
[1140]
[1141]
[1142]
[1143]
[1144]
[1145]
[1146]
[1147]
[1148]
[1149]
[1150]
[1151]
[1152]
[1153]
[1154]
[1155]
[1156]
[1157]
[1158]
[1159]
[1160]
[1161]
[1162]
[1163]
[1164]
[1165]
[1166]
[1167]
[1168]
[1169]
[1170]
[1171]
[1172]
[1173]
[1174]
[1175]
[1176]
[1177]
[1178]
[1179]
[1180]
[1181]
[1182]
[1183]
[1184]
[1185]
[1186]
[1187]
[1188]
[1189]
[1190]
[1191]
[1192]
[1193]
[1194]
[1195]
[1196]
[1197]
[1198]
[1199]
[1200]
[1201]
[1202]
[1203]
[1204]
[1205]
[1206]
[1207]
[1208]
[1209]
[1210]
[1211]
[1212]
[1213]
[1214]
[1215]
[1216]
[1217]
[1218]
[1219]
[1220]
[1221]
[1222]
[1223]
[1224]
[1225]
[1226]
[1227]
[1228]
[1229]
[1230]
[1231]
[1232]
[1233]
[1234]
[1235]
[1236]
[1237]
[1238]
[1239]
[1240]
[1241]
[1242]
[1243]
[1244]
[1245]
[1246]
[1247]
[1248]
[1249]
[1250]
[1251]
[1252]
[1253]
[1254]
[1255]
[1256]
[1257]
[1258]
[1259]
[1260]
[1261]
[1262]
[1263]
[1264]
[1265]
[1266]
[1267]
[1268]
[1269]
[1270]
[1271]
[1272]
[1273]
[1274]
[1275]
[1276]
[1277]
[1278]
[1279]
[1280]
[1281]
[1282]
[1283]
[1284]
[1285]
[1286]
[1287]
[1288]
[1289]
[1290]
[1291]
[1292]
[1293]
[1294]
[1295]
[1296]
[1297]
[1298]
[1299]
[1300]
[1301]
[1302]
[1303]
[1304]
[1305]
[1306]
[1307]
[1308]
[1309]
[1310]
[1311]
[1312]
[1313]
[1314]
[1315]
[1316]
[1317]
[1318]
[1319]
[1320]
[1321]
[1322]
[1323]
[1324]
[1325]
[1326]
[1327]
[1328]
[1329]
[1330]
[1331]
[1332]
[1333]
[1334]
[1335]
[1336]
[1337]
[1338]
[1339]
[1340]
[1341]
[1342]
[1343]
[1344]
[1345]
[1346]
[1347]
[1348]
[1349]
[1350]
[1351]
[1352]
[1353]
[1354]
[1355]
[1356]
[1357]
[1358]
[1359]
[1360]
[1361]
[1362]
[1363]
[1364]
[1365]
[1366]
[1367]
[1368]
[1369]
[1370]
[1371]
[1372]
[1373]
[1374]
[1375]
[1376]
[1377]
[1378]
[1379]
[1380]
[1381]
[1382]
[1383]
[1384]
[1385]
[1386]
[1387]
[1388]
[1389]
[1390]
[1391]
[1392]
[1393]
[1394]
[1395]
[1396]
[1397]
[1398]
[1399]
[1400]
[1401]
[1402]
[1403]
[1404]
[1405]
[1406]
[1407]
[1408]
[1409]
[1410]
[1411]
[1412]
[1413]
[1414]
[1415]
[1416]
[1417]
[1418]
[1419]
[1420]
[1421]
[1422]
[1423]
[1424]
[1425]
[1426]
[1427]
[1428]
[1429]
[1430]
[1431]
[1432]
[1433]
[1434]
[1435]
[1436]
[1437]
[1438]
[1439]
[1440]
[1441]
[1442]
[1443]
[1444]
[1445]
[1446]
[1447]
[1448]
[1449]
[1450]
[1451]
[1452]
[1453]
[1454]
[1455]
[1456]
[1457]
[1458]
[1459]
[1460]
[1461]
[1462]
[1463]
[1464]
[1465]
[1466]
[1467]
[1468]
[1469]
[1470]
[1471]
[1472]
[1473]
[1474]
[1475]
[1476]
[1477]
[1478]
[1479]
[1480]
[1481]
[1482]
[1483]
[1484]
[1485]
[1486]
[1487]
[1488]
[1489]
[1490]
[1491]
[1492]
[1493]
[1494]
[1495]
[1496]
[1497]
[1498]
[1499]
[1500]
[1501]
[1502]
[1503]
[1504]
[1505]
[1506]
[1507]
[1508]
[1509]
[1510]
[1511]
[1512]
[1513]
[1514]
[1515]
[1516]
[1517]
[1518]
[1519]
[1520]
[1521]
[1522]
[1523]
[1524]
[1525]
[1526]
[1527]
[1528]
[1529]
[1530]
[1531]
[1532]
[1533]
[1534]
[1535]
[1536]
[1537]
[1538]
[1539]
|1Server Side Includes (SSI)||

|^ The HTML pre-processor is used to provide dynamic information inside of an 
otherwise static, HTML (HyperText Markup Language) document.  The HTTPd server 
provides this as internal functionality, scanning the input document for 
special pre-processor |/directives||, which are replaced by dynamic 
information based upon the particular directive. 

|^ As of version 5.1 WASD SSI has been enhanced to provide flow-control
statements, allowing blocks of the document to be conditionally processed, see
|link|Flow Control||. These extensions allow quite versatile documents to be
created without resorting to script processing.

|^ Two documents are provided as examples of SSI processing.

|bullet|

|item| |*A simple SSI document.|

|table|
|~
|. |link%|/wasd_root/wasdoc/env/ssi.shtml?httpd=content&type=text/plain|\
WASD_ROOT:[WASDWASDOC.ENV]SSI.SHTML|
|. (|link%|/wasd_root/wasdoc/env/ssi.shtml|access as SSI||)
|!table|

|item| |*An SSI document using variable assignment and flow-control.|

|table|
|~
|. |link%|/wasd_root/wasdoc/env/xssi.shtml?httpd=content&type=text/plain|\
WASD_ROOT:[WASDWASDOC.ENV]XSSI.SHTML|
|. (|link%|/wasd_root/wasdoc/env/xssi.shtml|access as SSI||)
|!table|

|!bullet|

|^ By default the HTML pre-processor is invoked when the document file's
extension is ".SHTML". As there is a significant overhead with pre-processed
HTML compared to normal HTML, it should only be used when it serves a useful
documentary purpose, and not just for the novelty.

|^ Essential compatibility with OSU Server Side Includes is provided.  This
may ease any transition between the two.  See |link|OSU Compatibility|| for
further information.

|2Virtual Documents|

|^ One effective use for pre-processed HTML is the creation of single  virtual
documents from two or more physical documents.  That is, the pre-processed
document is used to include multiple physical documents, that  may even be
independently administered, to return a composite document to the  client. 
This is a relatively low-overhead activity as SSI goes, but because it is a 
dynamic document, without some extra considerations (see
|link|Last Modified Information||).

|0Example 1||

|^ This provides an example of the efficient use of SSI processing to create
virtual documents.  Each page will comprise a header (containing the body tag
and page header, etc), the document proper and a footer (containg the
end-of-page information, modification date, and end-body tag, etc).

|code|
<HTML>
<HEAD>
<TITLE>Just an example!</TITLE>
</HEAD>
<!--#include virtual="header.shtml" -->
<P> This is the document information.
<P> Blah, blah, blah.
<!--#include virtual="/web/common/footer.shtml" -->
</HTML>
|!code|

|^ A more efficient variant places the document proper in its own, plain HTML
file which is then #included (it is much, much, much more efficient for the
server to |/throw| a file at the network, than parse every character in one ;^)

|code|
<HTML>
<HEAD>
<TITLE>Just an example!</TITLE>
</HEAD>
<!--#include virtual="header.shtml" -->
<!--#include virtual="example.html" -->
<!--#include virtual="footer.shtml" -->
</HTML>
|!code|

|0Example 2||

|^ This example provides a seemingly more convoluted, but very much more
powerful configuration, that uses recursion to greatly simplify maintenance of
common-layout documents for the end-user.

|^ File 1; the document accessed via the browser URL, doesn't matter what
its name is, this configuration is completely naming independent.

|code|
<!--#ssi
#if var={PARENT_FILE_NAME} eqs=""
   #set var=TITLE value="Just an Example"
   #include virtual="/web/common/template.shtml"
#else 
   #include virtual="document.html"
#endif
-->
|!code|

|^ File 2; the TEMPLATE.SHTML refered to by the first include above.

|code|
<!--#ssi
#include virtual="/web/common/header.shtml"
#include virtual="{DOCUMENT_ROOT}header.html" fmt="?"
#include virtual="{DOCUMENT_URI}"
#include virtual="{DOCUMENT_ROOT}footer.html" fmt="?"
#include virtual="/web/common/footer.shtml"
-->
|!code|

|^ File 3; the DOCUMENT.HTML refered to by the second include in file 1.

|^ This is just a |*bunch of HTML||!

|^ |*This is an explanation of how it works |...|||

|number#|
|item| the browser accesses file 1 via a URL
|item| processing begins with file 1
|item| file 1 checks if it has a parent (is the first file processed),
|^- |*it doesn't and so |...|||
|item| file 1 set a variable named TITLE
|item| file 1 #includes file 2, a site-common template
|item| file 2 substitutes the TITLE variable contents as the document title
|item| file 2 #includes a site-common header
|item| file 2 #includes an optional document-local header
|item| |*here's the interesting bit |...|||
|^- file 2 now re-#includes the original document, file 1 (!!)
|item| file 1 checks if it has a parent (is the first file processed),
|^- |*it does and so |...|||
|item| file 1 #includes file 3 (the actual contents of the document)
|item| file 3 is a plain HTML document, just added to the output
|item| file 1 is now exhausted and processing returns to file 2
|item| file 2 #includes an optional document-local footer
|item| file 2 #includes a site-common footer
|item| file 2 is exhausted and processing returns to file 1
|item| file 1 is exhausted and processing stops
|!number|

|^ The following link provides an example of a
|link%|/wasd_root/wasdoc/env/example_document.shtml|such a virtual document||.

|2Last-Modified Information|

|^ SSI documents generally contain dynamic elements, that is those that may
change with each access to the document (e.g. current date/time).  This makes
evaluation of any document modification date difficult and so by default no
"Last-Modified: |/timestamp||" information is supplied against an SSI document.  The
potential efficiencies of having document timestamps, so that requests can be
made for a document to be returned only if modified after a certain date/time
("If-Modified-Since: |/timestamp||"), are significant against
the CPU overheads of processing SSI documents.

|^ WASD allows the document author to determine whether or not a last-modified
header field should be generated for a particular document and which
contributing file(s) should be used to determine it.  This is done using
the #modified directive.  If a virtual document is made up of multiple source
documents (files) each can be assessed using multiple virtual= or file= tags,
the most recently modified will be used to determine if the virtual document
has been modified, and also to generate the last-modified timestamp.

|^ The |/if-modified-since|| tag compares the determined revision
date/time of the document file(s) with any "If-Modified-Since:"
timestamp supplied with the request.  If the virtual document's revision
date/time is the same or older than the request's then a not-modified (304
status) header is generated and sent to the client and document processing
ceases.  If more recent an appropriate "Last-Modified:" header field is
added to the document and it continues to be processed.

|^ If a request has a "Pragma: no-cache" field (as with Navigator's
|/reload|| function) the document is always generated (this is
consistent with general WASD behaviour).
The following example illustrates the essential features.

|code|
<!--#ssi
#modified
#modified virtual="/web/common/header.shtml"
#modified virtual="header.html" fmt="?"
#modified virtual="index.html"  fmt="?"
#modified virtual="footer.html" fmt="?"
#modified virtual="/web/common/footer.shtml"
#modified if-modified-since
-->
|!code|

|^ This construct should be placed at the very beginning of the SSI document,
and certainly before there is any chance of output being sent to the browser. 
Once output to the client has occured there can be no change to the response
header information (not unreasonably).

|2Pre-Expiring Documents|


|^ SSI preprocessed documents are |/dynamic|| in the sense that the
information presented can be different every time the document is generated
(e.g. if time directives are included).  If it is important that each time the
document is accessed it is regenerated then an HTML META tag can be included in
the HTML header to cause the document to |/expire||.  This will result
in the document being reloaded with each access.  This can be accomplished two
ways.

|bullet|


|item| Use the #modified directive to include an "Expires:
|/timestamp||" response header field.  Place the following construct at
the beginning of the SSI document.

|code|
<!--#modified expires="Fri, 13 Jan 1978 14:00:00 GMT" -->
|!code|
 An alternative, if the objective to to pre-expire the document, is to
specify an expiry of zero.  The is specially handled by the SSI engine.  It
adds an expiry response header field, plus cache-control header fields to
suppress document caching (on compliant browsers).

|code|
<!--#modified expires="0" -->
|!code|

|!bullet|


|2Directive Syntax|


|^ The syntax follows closely that used by the other implementations, but
some directives are tailored to the WASD and VMS environment. The directive is
enclosed within an HTML comment and takes the form: 

|code|
<!--#|*directive|| [[|*tag1||="|/value||"] [|*tag2||="|/value||"] ...] -->
|!code|

|^ A |/tag|| provides parameter information to the directive.  A directive may
have zero, one or more parameters.  Values supplied with any tag may be literal
or via variable substitution (see |link|Variables||).  A value must be encolosed
by quotation marks if it contains white-space.

|^ A directive |*can be split over multiple lines|| provided the
new line begins naturally on white-space within the directive.  For example,
this is correctly split

|code|
<!--#echo
created[="<EMPHASIS>(time-format)"] -->
|!code|
 while the following is not (and would produce an error)

|code|
<!--#echo creat
ed[="<EMPHASIS>(time-format)"] -->
|!code|

|^ Directive and tag keywords are case insensitive.  The tag value may or 
may not be case sensitive, depending upon the command/tag.  Generally the 
effect of a command is to produce additional text to be inserted in the 
document, although it is possible to control the flow of processing in a
document with decision structures.

|2Directives|

|0SSI Directives|

|table|
|~_ |: Directive|: Description|: Section
|~
|~#* |. #accesses |. document access count |. |link|Accesses|
|~ |. #config |. document processing options |. |link|Config|
|~ |. #dir |. directory listing |. |link|Dir|
|~ |. #dcl |. DCL command processing |. |link|DCL|
|~ |. #echo |. output information |. |link|echo|
|~ |. #elif |. flow control |. |link|elif|
|~ |. #else |. flow control |. |link|else|
|~ |. #endif |. flow control |. |link|endif|
|~ |. #exec |. same as "#dcl" |. |link|exec|
|~ |. #exit |. flow control, stop current document processing |. |link|exit|
|~ |. #fcreated |. output file creation date/time |. |link|fcreated|
|~ |. #flastmod |. output file last modification date/time |. |link|flastmod|
|~ |. #fsize |. output file size |. |link|fsize|
|~ |. #if |. flow control |. |link|if|
|~ |. #include |. include a text file or another SSI document |. |link|include|
|~ |. #modified |. HTTP response control |. |link|modified|
|~ |. #orif |. flow control |. |link|orif|
|~ |. #printenv |. list document variables |. |link|printenv|
|~ |. #set |. assign value to a document variable |. |link|set|
|~ |. #ssi |. block of SSI statements |. |link|ssi|
|~ |. #stop |. stop SSI processing completely |. |link|stop|
|!table|

|3.#ACCESSES|

|^ The |/.#accesses|| directive allows the number of times the document 
has been accessed to be included.  It does this by creating a counter file in 
the same location and using the same name with a dollar symbol appended to the 
type (extension).  The count may be reset by deleting the file.  This is an 
expensive function (in terms of file system activity) and so should be used 
appropriately.  It can be disabled by server configuration.  Three tags provide 
additional functionality: 

|bullet|

|item| |*ORDINAL|

|code|
<!--#accesses ordinal -->
|!code|

|^ Provides the count as 1st, 2nd, 3rd, 4th, 5th |...| 10th, 11th, 12th
|...| 120th, 121st, 122nd, etc.

|item| |*SINCE|

|code|
<!--#accesses since="|/text||" -->
|!code|

|^ This tag includes the specified text immediately after the access count is 
displayed, then adds the creation date of the counter file.

|item| |*TIMEFMT|

|code|
<!--#accesses since="|/text||" timefmt="[|/time-format||]" -->
|!code|

Allows the time format of the |/since|| tag to be supplied, where 
|/time-format|| is specified according to |link|Time Format||. 

|!bullet|

|3.#CONFIG|

|^ The |/.#config| directive allows time and file size formats to be  specified
for all subsequent directives providing these values.  Optional  specifications
for individual directives may still be made, and override, do  not supercede,
any specification made using a |/config| directive.  A  |/config| directive may
be made once, or any number of times in a  document, and applies until another
is made, or until the end of the document. 

|bullet|

|item| |*ERRMSG|

|code|
<!--#config errmsg="|/string||" -->
|!code|

|^ This directive allows the error message generated if a problem problem
processing the SSI document occurs (e.g. miss-spelled directive) to be
specified in the document. 

|item| |*TIMEFMT|

|code|
<!--#config timefmt="|/time-format||" -->
|!code|

Where |/time-format|| is specified according to|link|Time Format||.

|item| |*SIZEFMT|

|code|
<!--#config sizefmt="|/size-format||" -->
|!code|

Where |/size-format| is specified using the following keywords:

|bullet#|
|item| "abbrev" (as bytes, kbytes, Mbytes)
|item| "blocks" (VMS blocks, used)
|item| "bytes" (e.g. "1,256,731 bytes")
|!bullet|

|item| |*TRACE|

|code|
<!--#config trace="|/1||\||/0||"  -->
|!code|

|^ Switches document processing trace on or off, intended for use when
debugging more complex or flow-controlled SSI documents.

|^ Output from a trace is colour-coded.

|bullet|

|item| |*Blue |-| |
As a line is read from the document is is displayed in blue.  The text is
preceded by a square-bracketed source file line number and flow-control level.

|item| |*Red |-| |
As an SSI statement is actually processed it is displayed in red. Due to
document parsing this may occur at some point after the line is read from file.

|item| |*Magenta |-| |
As variables are set or read the variable name and value is displayed.  A
variable set has the name separated from the value by an equate symbol
("="), when being read the character is a full-colon (":"). 

|item| |*Black |-| |
Document (HTML and text) output is displayed as black plain text.

|!bullet|

|^ The following link provides an example of a
|link%|/wasd_root/wasdoc/env/xssi.shtml?httpd=ssi&trace=on|document trace||.

|!bullet|

|3.#DIR|

|^ The |/.#dir| directive generates an |/Index of |...||| directory listing
inside an HTML document.  Apart from not  generating a title (it is up to the
pre-processed document to title, or  otherwise caption, the listing) it
provides all the functionality of the WASD  HTTPd directory listing (see
|link|Directory Listing||), including query string format control via the
"par=" parameter (note that from the "?httpd=index" introducer used with
directory listings is not necessary from SSI). It is an WASD HTTPd extension to
pre-processed HTML.

|bullet|

|item| |*FILE|

|^ Listing specified using a VMS file path. 

|code|
<!--#dir file="|/file-name||" [par="|/server-directive(s)||"] -->
|!code|

|item| |*VIRTUAL|

|^ Listing specified using URL-style syntax. 

|code|
<!--#dir virtual="|/path||" [par="|/server-directive(s)||"] -->
|!code|

|!bullet|

|^ For example:

|code|
<!--#dir file="/wasd_root/src/httpd/" -->

<!--#dir file="/wasd_root/src/httpd/*.c" par="layout=UL__S&nops=yes" -->
|!code|

|3.#DCL|

|^ The |/.#dcl| directive executes a DCL command and incorporates the output
into the processed document.  It is an WASD HTTPd extension to the more common
|/exec| directive, which is also included.

|^ By default, output from the DCL command has all HTML-forbidden characters
(e.g. "<", "&") escaped before inclusion in the processed document.  Thus
command output cannot interfere with document  markup, but nor can the DCL
command provide HTML markup.  This behaviour may be changed by appending the
following tag to the directive:

|code|
type="text/html"
|!code|

|^ Some |/.#dcl| directives are for |/privileged| documents only, documents
defined as those being owned by the SYSTEM account, and not  being
world-writeable.  The reason for this should be obvious.  There are implicit
security concerns about any document being able to execute any DCL command(s),
even if it is being executed in a completely unprivileged process.  Hence only
|/innocuous| commands are allowed in standard documents. 

|bullet|

|item| |*SAY|

|^ Execute the DCL "WRITE SYS$OUTPUT" command, using the  specified parameter. 

|code|
<!--#dcl say="hello." -->
|!code|

|item| |*SHOW|

|^ Execute the DCL "SHOW" command, using the specified parameter. 

|code|
<!--#dcl show="device/full tape1:" -->
|!code|

|item| |*DIR|

|^ Execute the DCL "DIRECTORY" command, using the supplied file specification. 
Qualifiers may be included in the optional "par" tag to control the format of
the listing.

|code|
<!--#dcl dir="web:[000000]" -->
<!--#dcl dir="web:[000000]" par="/nohead/notrail" -->
<!--#dcl dir="web:[000000]" par="/size/date" -->
|!code|

|item| |*EXEC| (privileged)

|^ Execute the specified DCL command.

|code|
<!--#dcl exec="show device/full tape1:" -->
|!code|

|item| |*FILE| (privileged)

|^ Execute the DCL command procedure specified as a VMS file path, with any 
specified parameters applied to the procedure. 

|code|
<!--#dcl file="WASD_ROOT:[SHTML]TEST.COM" par="PARAM1 PARAM2" -->
|!code|

|item| |*VIRTUAL| (privileged)

|^ Execute the DCL command procedure specified in URL-style syntax, with any 
specified parameters applied to the procedure. 

|code|
<!--#dcl virtual="../shtml/test.com" par="PARAM1 PARAM2" -->
|!code|

|item| |*CGI|

|^ Execute the specified CGI script.  The CGI response header is suppressed and
only the response body is included in the document.

|code|
<!--#dcl cgi="/cgi-bin/calendar?2004" -->
|!code|

|!bullet|

|3.#ECHO|

|^ The |/.#echo| directive incorporates the specified information into the
processed document. Multiple tags may be used within the one directive.

|bullet|

|item| |*VALUE=|
|^-|*VAR=|

|^ Any SSI variable (e.g. CREATED), CGI variable (e.g. HTTP_USER_AGENT),
or document assigned variable (e.g. EXAMPLE1), see |link|Variables||.

|code|
<!--#echo value={created} var={example1} -->
|!code|

|item| |*CREATED|

|^ The date/time of the current document's creation.

|code|
<!--#echo created[="|/time-format||"] -->
|!code|

|item| |*DATE_LOCAL|

|^ Include the current date/time.

|code|
<!--#echo date_local[="|/time-format||"] -->
|!code|

|item| |*DATE_GMT|

|^ Include the current Greenwich Mean Time (UTC) date/time.

|code|
<!--#echo date_gmt[="|/time-format||"] -->
|!code|

|item| |*DOCUMENT_NAME|

|^ The current document's URL-style path.

|code|
<!--#echo document_name -->
|!code|

|item| |*FILE_NAME|

|^ The current document's VMS file path.

|code|
<!--#echo file_name -->
|!code|

|item| |*HEADER|

|^ Append the specified string to the response header (with correct carriage
control).  Should be used as early as possible in the SSI document.

|code|
<!--#echo header="Pragma: no-cache" -->
<!--#echo header="X-Extension-Header: just an example!" -->
|!code|

|item| |*LAST_MODIFIED|

|^ The date/time of the current document's last modification.

|code|
<!--#echo last_modified[="|/time-format||"] -->
|!code|

|!bullet|

|3.#ELIF|

|^ The |/.#elif| directive (else-if) allows blocks of HTML markup and SSI
directives to be conditionally processed, see |link|Flow Control|| and
|link|if||.  This directive effectively allows a |/case| statement to be
constructed.

|code|
<!--#elif var="[|/{variable}||\||/literal||" -->
|!code|
 
|3.#ELSE|

|^ The |/.#else| directive allows blocks of HTML markup and SSI directives to be
conditionally processed, see |link|Flow Control||.  It is the default block
after an "#if", "#orif" or "#elif".

|code|
<!--#else -->
|!code|
 
|3.#ENDIF|

|^ The |/.#endif| directive marks the end of a block of document text
being conditionally processed, see |link|Flow Control||.

|code|
<!--#endif -->
|!code|

|3.#EXEC|

|^ The |/.#exec| directive executes a DCL command and incorporates the  output
into the processed document.  It is the VMS equivalent of the  |/exec| shell
directive of some Unix implementations.  It is  implemented in the same way as
the #DCL directive, and so the general detail  of that directive applies.  It
supports both the |/cmd| tag and the  |/cgi| tag, allowing execution of CGI
scripts (the response header is absorbed).

|code|
<!--#exec cmd="show device/full tape1:" -->
<!--#exec cgi="/cgi-bin/calendar?2004" -->
|!code|

|^ The |/.#exec| directive is for |/privileged| documents only, documents
defined as those being owned by the SYSTEM account, and not being
world-writeable.  The reason for this should be obvious.  There are implicit
security concerns about any document being able to execute any DCL command(s),
even if it is being executed in a completely unprivileged process. 
 
|3.#EXIT|

|^ The |/.#exit| directive causes the server to stop processing the current SSI
file.  If the current file was an #included SSI file, processing continues back
with the parent file.  Note that the |/.#stop| directive also is available, it
stops processing of the entire virtual document.

|code|
<!--#exit -->
|!code|
 
|3.#FCREATED|

|^ The |/.#fcreated| directive incorporates the creation date/time of a
specified file/document into the processed document. 

|bullet|

|item| |*FILE|

|^ Document specified using a VMS file path. 

|code|
<!--#fcreated file="|/file-name||" [fmt="|/time-format||"] -->
|!code|

|item| |*VIRTUAL|

|^ Document specified using URL-style syntax. 

|code|
<!--#fcreated virtual="|/path||" [fmt="|/time-format||"] -->
|!code|

|!bullet|

|3.#FLASTMOD|

|^ The |/.#flastmod| directive incorporates the last modification 
date/time of a specified file/document into the processed document. 

|bullet|


|item| |*FILE||

|^ Document specified using a VMS file path. 

|code|
<!--#flastmod file="|/file-name||" [fmt="|/time-format||"] -->
|!code|

|item| |*VIRTUAL||

|^ Document specified using URL-style syntax. 

|code|
<!--#flastmod virtual="|/path||" [fmt="|/time-format||"] -->
|!code|

|!bullet|

|3.#FSIZE|

|^ The |/.#fsize|| directive incorporates the size, in bytes, kbytes or 
Mbytes, of a specified file/document into the processed document. 

|bullet|

|item| |*FILE|

|^ Document specified using a VMS file path.

|code|
<!--#fsize file="|/file-name||" [fmt="|/size-format||"] -->
|!code|

|item| |*VIRTUAL|

|^ Document specified using URL-style syntax.

|code|
<!--#fsize virtual="|/path||" [fmt="|/size-format||"] -->
|!code|

|!bullet|

|3.#IF|

|^ The |/.#if| directive allows blocks of HTML markup and SSI directives to be
conditionally processed, see |link|Flow Control||.

|bullet|

|item| |*VAR=|

|^ Variable the decision will be based upon.

|code|
<!--#if var="[|/{variable}||\||/literal||]" -->
|!code|

|item| |*EQS=|

|^ Is the string the same as in the variable?

|item| |*EQ=|

|^ If the variable is a number is it the same as this?

|item| |*GT=|

|^ If the variable is a number is it greater than this?

|item| |*LT=|

|^ If the variable is a number is it less than this?

|item| |*SRCH=|

|^ Search the variable for this string.  May contain the |=.*| (asterisk)
wildcard, matching one or more characters, and the |*.%| (percentage), matching
any single character.

|!bullet|

|^ As in the following examples:

|code|
<!--#if value={DOCUMENT_URI} eqs="/wasd_root/doc/env/xssi.shtml" -->
<!--#if value={COUNT} lt=10 -->
<!--#if value="This is a test!" eqs={STRING} -->
<!--#if value={PATH_INFO} srch="*/env/*" -->
|!code|
 
|3.#INCLUDE|

|^ The |/.#include| directive incorporates the contents of a specified 
file/document into the processed document.

|bullet|

|item| |*FILE|

|^ Include the contents of the document specified using a VMS file
specification.

|code|
<!--#include file="|/file-name||" -->
|!code|

|item| |*VIRTUAL|

|^ Include the contents of the document specified using URL-style syntax.

|code|
<!--#include virtual="|/path||" -->
|!code|

|!bullet|

|^ The contents of the specified file are included differently depending on the
MIME content-type of the file.  Files of |/text/html| content-type (HTML
documents) are included directly, and any HTML tags within them contribute to
the markup of the document.  Files of |/text/plain| content-type (plain-text
documents) are encapsulated in "<pre></pre>" tags and have all HTML-forbidden
characters (e.g. "<", "&") escaped before inclusion in the processed document. 
An HTML file can be forced to be included as plain-text by using the following
syntax:

|code|
<!--#include virtual="example.html" type="text/plain" -->
|!code|

|^ To "force" a file to be considered as text regardless of the actual content
(as determined by the server from the file type), use on of the following
depending on whether it should be rendered as plain or HTML text.

|code|
<!--#include virtual="example.html" content="text/plain" -->
<!--#include virtual="example.html" content="text/html" -->
|!code|

|^ Other SSI files may be included and their content dynamically included in
the resulting document.  To prevent a recursive inclusion of documents the
nesting level of SSI documents is limited to five.
 
|3.#MODIFIED|

|^ The |/.#modified| directive allows a document author to control the
"Last-Modified:"/"If-Modified-Since:"/"304 Not modified" behaviour of an SSI
document.  See |link|Virtual Documents||.

|bullet|

|item| |*/no tag|

|^ Get the last-modified date/time of the current document.

|code|
<!--#modified -->
|!code|

|item| |*FILE|

|^ Get the last-modified date/time of the document specified using VMS file
specification.

|code|
<!--#modified file="|/file-name||" -->
|!code|

|item| |*VIRTUAL|

|^ Get the last-modified date/time of the document specified using URL-style
syntax.

|code|
<!--#modified virtual="|/path||" -->
|!code|

|item| |*IF-MODIFIED-SINCE|

|^ Compares any "If-Modified-Since:" request header timestamp to the revision
date time obtained using |/file| or |/virtual| (most recent if multiple).  If
the document timestamp is more recent (has been modified) an appropriate
"Last-Modified" response header field is generated and added to the response,
and document processing continues.  If it has not been modified a "304"
response header is return (document not modified) and document processing
stops.

|code|
<!--#modified if-modified-since -->
|!code|

|item| |*LAST-MODIFIED|
|^ Adds a "Last-Modified:" response header field using a timestamp retrieved
using |/file| or |/virtual| (note: unnecessary if the |/if-modified-since| tag
is used).

|code|
<!--#modified last-modified -->
|!code|

|item| |*EXPIRES|

|^ Adds a "Expires:" response header field.  The string literal should be a legitimate RFC-1123 date string.  This can be
used for pre-expiring documents (so they are always reloaded), set it to a date
in the not-too-distant past (as in the example below). Of course it could also
be used for setting the legitimate future expiry of documents.

|code|
<!--#modified expires="Fri, 13 Jan 1978 14:00:00 GMT" -->
|!code|

|!bullet|

|3.#ORIF|

|^ The |/.#orif| directive (or-if) allows blocks of HTML markup and SSI
directives to be conditionally processed, see |link|Flow Control| and
|link|if||.  In the absence of any real expression parser this directive allows
a block to be processed if one of multiple conditions are met.

|code|
<!--#orif var="[|/{variable}||\||/literal||" -->
|!code|
 
|3.#PRINTENV|

|^ The |/.#printenv| directive prints a plain-text list of all SSI-specific,
then CGI, then document-assigned variables (see |link|Variables||). This
directive is intended for use when debugging flow-controlled SSI documents.

|code|
<!--#printenv -->
|!code|

|^ The following link uses the example SSI document
|link%|/wasd_root/wasdoc/env/xssi.shtml?httpd=ssi&text=plain|\
WASD_ROOT:[WASDOC.ENV]XSSI.SHTML| to
|link%|/wasd_root/wasdoc/env/xssi.shtml|demonstrate| this.

|3.#SET|

|^ The |/.#set| directive allows a user variable to be assigned or modified,
see |link|Variables||.

|code|
<!--#set var="|/variable-name||" value="|/whatever||" -->
|!code|

|^ Variables are always stored as strings and have a finite but generally
usable length.  Some comparison tags provided in the flow-control directives
treat the contents of variables as numbers.  A numeric conversion is done at
evaluation time.
 
|3.#SSI|

|^ The |/.#ssi| directive allows multiple SSI directives to be used without the
requirement to enclose them in the normal HTML comment tags (i.e. <!-- -->).
This helps reduce the clutter in an SSI document that uses the extended
capabilities of variable assignment and flow control. Document HTML cannot be
included between the opening and closing comment elements of the "#ssi" tag,
although of course document output can be generated using the "#echo" tag.

|code|
<!--#ssi
#set var=HOUR value={DATE_LOCAL,12,2}
#if var={HOUR} lt=12
  #set var=GREETING value="Good morning"
#elif var={HOUR} lt=19
  #set var=GREETING value="Good afternoon"
#else
  #set var=GREETING value="Good evening"
#endif
-->
|!code|

|^ The example SSI document
|link%|/wasd_root/wasdoc/env/xssi.shtml?httpd=ssi&text=plain|\
WASD_ROOT:[WASDOC.ENV]XSSI.SHTML| will
|link%|/wasd_root/wasdoc/env/xssi.shtml|demonstrate| this concept.

|3.#STOP|

|^ The |/.#stop| directive causes the server to stop processing the virtual
document.  It can be used with flow control structures to conditionally process
only part of a virtual document.  Note that the |/.#exit| directive also is
available, it stops processing of the current file (for nested #includes,
etc.). 

|code|
<!--#stop -->
|!code|
 
|2Variables|

|^ The SSI processor maintains information about the server, date and time,
request path, request parameters, etc., accessible via |/variable name||.
Although these |/server variables| cannot be modified by the document the
processor also allows the author to create and assign new |/document variables|
by name.  SSI variables have global scope, with a small number of exceptions
listed below.  That is, the same set of variables are shared with the parent
document by any other SSI documents |/.#included||, and any included by those,
etc.

|^ Local variables:

|bullet#|
|item| DOCUMENT_DEPTH |-| the current nesting level for #included SSI files
|item| PARENT_FILE_NAME |-| if an #included SSI file the name of the including file
|item|THIS_FILE_NAME |-| the name of the SSI file currently being processed
|!bullet|

|^ One other special-purpose variable, THE_FILE_NAME, see |link|THE_FILE_NAME||.

|^ Server assigned variables comprise some SSI-specific as well as the same
CGI variables available to CGI scripts. These may be found listed in the
|link%|../scripting/##CGI Variables++in++WASD Scripting| document.

<P> The following link provides a list of the
|link%|/wasd_root/wasdoc/env/xssi.shtml?httpd=ssi&printenv=yes|\
SSI and CGI variables| available to SSI documents.

|^ Whenever a directive uses information from a tag (see |link|Directive
Syntax||) values from variables may be substituted as as a whole or partial
value.  This is done using curly braces to delimit the variable name.  For
example

|code|
<!--#include virtual={FILENAME} -->
|!code|

would include the file named by the contents of a variable named "FILENAME".
When using a variable in a tag it is not necessary to enclose the tag parameter
in quotation marks unless there is additional literal text.  Variables may also
be used within literal strings, producing a compound, resultant string, as in
the following example

|code|
<!--#echo var="Hello {REMOTE_HOST}, time here is {LOCAL_TIME}" -->
|!code|

|^ Variables are considered numeric when they begin with a digit.  Those
beginning with an alphabetic are considered to have a numeric value of zero.

|^ Variables are considered to be boolean |/false| if empty and |/true| when
not empty.

|0Substrings|

|^ It is also possible to extract substrings from variables using the following
syntax,

|code|
{|/variable-name||,|/start-index||,|/count||}
|!code|

|^ where the start-index begins with the zeroth character and numbers up to
the last character in the string, and count may be zero or any positive number.
If only one number is supplied it is regarded as a count and the string is
extracted from the zeroth character.

|^ To illustrate,

|code|
<!--#set var=EXAMPLE value="This is an example!" -->
<!--#echo "{EXAMPLE,2}at was {EXAMPLE,8,999}" -->
|!code|

|^ would output

|code|
That was an example!
|!code|

|0Other "Functions"|

|bullet|

|item| |*LENGTH - || This "function" returns the length of the parameter string
(or substring).

|code|
{|/variable-name||[,|/start-index||],|/count||]],length}
|!code|

|^ For example

|code|
<!--#set var=EXAMPLE value="This is an example!" -->
<!--#echo "\\"{EXAMPLE}\\" is {EXAMPLE,length} characters long." -->
<!--#echo "\\"{EXAMPLE,5,2}\\" is {EXAMPLE,5,2,length} characters long!" -->
|!code|

|^ would output

|code|
"This is an example!" is 19 characters long.
"is" is 2 characters long!
|!code|

|item| |*EXISTS |-| | This "function" returns |/true| if the variable exists and
|/false| if it does not.  This is useful as accessing a non-existant variable
will result in an SSI error message with document processing ceasing!

|code|
var={|/variable-name||,exists}
|!code|

|^ For example

|code|
<!--#set var=BOGUS_VARIABLE value="irrelevant" -->
<!--#if var={BOGUS_VARIABLE,exists} -->
&quot;BOGUS_VARIABLE&quot; exists!
<!--#else -->
&quot;BOGUS_VARIABLE&quot; does NOT exist!
<!--#endif -->
|!code|

|!bullet|

|^ The example SSI document
|link%|/wasd_root/wasdoc/env/xssi.shtml?httpd=ssi&text=plain|\
WASD_ROOT:[WASDOC.ENV]XSSI.SHTML| can
|link%|/wasd_root/wasdoc/env/xssi.shtml|demonstrate| these concepts.
 
|2Flow Control|

|^ WASD SSI allows blocks of document to be conditionally processed. This
uses constructs in a similar way to any programming language.  The emphasis
has been on simplicity and speed of processing.  No complex expression parser
is provided.  Despite this, complex document constructs can be implemented.
Flow control structures may be nested up to eight levels.

|bullet|

|item| |*.#if |-| |
Marks the start of a conditionally processed block.  If evaluated true the
block is processed.

|item| |*.#orif |-| |
Allows a document block to be
processed if one of multiple conditions are met. Must be used immediately
following a "#if" or "elif". (This is the only really
WASD-idiosyncratic element)

|item| |*.#elif |-| |
Allows a series of conditionals to be tested each with its own document block
available for processing.  Allows a type of case statement to be constructed.

|item| |*.#else |-| |
Provides a default document block following unsuccessful "#if",
"orif" and "elif" testing and consequent non-processed blocks.

|item| |*.#endif |-| |
Terminates a conditional block.

|!bullet|

|^ The "#if", "#orif" and "#elif" directives must provide an evaluation. This
can be single variable, which if numeric and non-zero is considered true, if
zero if false, or can be a string, which if empty is false, and if not empty is
true.  Tests can be made against the variable which when evaluated return a
true or false.  Multiple tests may be made against the one variable, or against
more than one variable.  Multiple tests act as a logical AND of the results and
terminate when the first fails.

|bullet|

|item| |*eqs |-| |
If the supplied string is the same as the variable string.

|item| |*srch |-| |
If the variable string matches the supplied search string. The search string
may contain the |=.*|| (asterisk), matching any zero or more characters, and
|=.%| (percentage), matching any one character.

|item| |*eq |-| |
If the numeric value of the variable is the same as that of the supplied
number.  For a numeric value test to be legitimate both values must begin with
a digit.  Those beginning with an alphabetic are considered zero.

|item| |*lt |-| |
If the numeric value of the variable is less than that of the supplied number.

|item| |*gt |-| |
If the numeric value of the variable is greater than that of the supplied
number.

|!bullet|

|^ Any evaluation can have the result negated by prefixing it with an
exclamation point.  For instance, the first of these examples would produce a
|/false| result, the second |/true||.

|code|
<!--#if value="test" !eqs="test" -->
<!--#if value=20 !lt=10 -->
|!code|

|^ The following is a simple example illustration of variable setting, use
of variable substrings, and conditional processing of document blocks.

|code|
<!--##config trace=1 -->
<HTML>
<!--#set var=HOUR value={DATE_LOCAL,12,5} -->
<!--#if var={HOUR} lt=12 -->
<!--#set var=GREETING value="Good morning" -->
<!--#elif var={HOUR} lt=19 -->
<!--#set var=GREETING value="Good afternoon" -->
<!--#else -->
<!--#set var=GREETING value="Good evening" -->
<!--#endif -->
<HEAD>
<TITLE><!--#echo var={GREETING} -->
<!--#echo var="{REMOTE_HOST}!" --></TITLE>
</HEAD>
<BODY>
<H1>Simple XSSI Demonstration</H1>
<!--#echo var={GREETING} --> <!--#echo var={REMOTE_HOST} -->,
the time here is <!--#echo var={DATE_LOCAL,12,5} -->.
<!--#if var={REMOTE_HOST} eqs={REMOTE_ADDR} -->
(Sorry, I do not know your name, DNS lookup must be disabled!)
<!--#endif -->
</BODY>
</HTML>
|!code|

|^ The example SSI document
|link%|/wasd_root/wasdoc/env/xssi.shtml?httpd=ssi&text=plain|\
WASD_ROOT:[WASDOC.ENV]XSSI.SHTML| further
|link%|/wasd_root/wasdoc/env/xssi.shtml|illustrates| these concepts.
 
|2Query Strings|

|^ A query string may be passed to an SSI document in much the same way as to
a CGI script. In this way the behaviour of the document can be varied in
accordance to information explicitly passed to it when accessed. To prevent
the server's default query engine being given the request precede any query
string with "?httpd=ssi". The server detects this and passes the
request instead to the SSI processor. Just append the desired query string
components to this as if they were form elements. For example:

|code|
?httpd=ssi&printenv=no
?httpd=ssi&printenv=yes
?httpd=ssi&trace=yes&test2=one&test2=two&test3=three
|!code|

|^ The following link uses the example SSI document
|link%|/wasd_root/wasdoc/env/xssi.shtml?httpd=ssi&text=plain|\
WASD_ROOT:[WASDOC.ENV]XSSI.SHTML| to
|link%|/wasd_root/wasdoc/env/xssi.shtml|demonstrate|
this. Look for the <QUOTE>(FORM_TEST1=one), etc.

|2File and Virtual Specifications|

|^ Documents may be specified using either the "FILE" or "VIRTUAL" tags.

|^ The "FILE" tag expects an absolute VMS file specification.

|^ The "VIRTUAL" tag expects an URL-style path to a document.  This can be an
absolute or relative path.  See |link|Document Specification| for further
details.

|3THE_FILE_NAME|

|^ Generally, when an error are encountered document processing halts and
and an error report is generated.  For some common circumstances, in particular
the existance or not of a particular file, may require an alternative action. 
For file activities (e.g. #include, #flastmod, #created, #fsize) the optional
fmt="" tag provides some measure of control on error behaviour.  If the format
string begins with a "?" files not found are not reported as errors and
processing continues.  Other file systems errors, such as directory not found,
syntax errors, etc., are always reported.

|^ Every time a file is accessed (e.g. #include, #flastmod) the server
variable THE_FILE_NAME gets set to that name if successful, or reset to empty
if unsuccessful.  This variable can be checked to determine success or
otherwise.

|bullet|

|item| For #included files, the 'fmt="?"' just suppresses an error report, if
the file exists then it is included.

|item| For #modified file specifications use 'fmt="?"' to suppress error
reporting on evaluation of files that may exist but are not mandatory.

|item| For file statistic directives (e.g. #flastmod, #fcreated, #fsize) the
'fmt="?"' tag completely suppresses all output as well as error reporting. 
This can be used to check for the existance of a file.  For example if the file
TEST.TXT exists in the following example the variable THE_FILE_NAME would
contain the full file name, if it does not exist it would be empty, and the
code example would behave accordingly.

|code|
<!--#fcreated virtual="TEST.TXT" fmt="?" -->
<!--#if var={THE_FILE_NAME} eqs="" -->
File does not exist!
<!--#else -->
File exists!
<!--#endif -->
|!code|

|!bullet|

|2Time Format|

|^ Whenever a time directive is used an optional tag can be included to
specify the format of the output.  The default looks a little VMS-ish.  If a
format specification is made it must confirm to the C programming language
function |/strftime()||.

|^ The format specifier follows a similar syntax to the C standard library
|/printf()| family of functions, where conversion specifiers are introduced by
percentage symbols.  Here are some example uses:

|code|
The date is <!--#echo date_local fmt="%d/%m/%y" -->.
The time is <!--#echo date_local fmt="%r" -->.
The day-of-the-week is <!--#echo date_local fmt="%A" -->.
|!code|

|^ A problem with any supplied time formatting specification will be reported.

|^ The following table provides the general conversion specifiers.  For further
information on the formatting process refer to a C programming library document
on the |/strftime()| function.

|0strftime() Format Directives|

|table|
|~_ |: Specifier|: Replaced by
|~
|~#* |. a |. The locale's abbreviated weekday name
|~ |. A |. The locale's full weekday name
|~ |. b |. The locale's abbreviated month name
|~ |. B |. The locale's full month name
|~ |. c |. The locale's appropriate date and time representation
|~ |. C |. The century number (the year divided by 100 and truncated
to an integer) as a decimal number (00 - 99)
|~ |. d |. The day of the month as a decimal number (01 - 31)
|~ |. D |. Same as %m/%d/%y
|~ |. e |. The day of the month as a decimal number (1 - 31) in a
2 digit field with the leading space character fill
|~ |. Ec |. The locale's alternative date and time representation
|~ |. EC |. The name of the base year (period) in the locale's
alternative representation
|~ |. Ex |. The locale's alternative date representation
|~ |. EX |. The locale's alternative time representation
|~ |. Ey |. The offset from the base year (%EC) in the locale's
alternative representation
|~ |. EY |. The locale's full alternative year representation
|~ |. h |. Same as %b
|~ |. H |. The hour (24-hour clock) as a decimal number (00 - 23)
|~ |. I |. The hour (12-hour clock) as a decimal number (01 - 12)
|~ |. j |. The day of the year as a decimal number (001 - 366)
|~ |. m |. The month as a decimal number (01 - 12)
|~ |. M |. The minute as a decimal number (00 - 59)
|~ |. n |. The newline character
|~ |. Od |. The day of the month using the locale's alternative
numeric symbols
|~ |. Oe |. The date of the month using the locale's alternative
numeric symbols
|~ |. OH |. The hour (24-hour clock) using the locale's alternative
numeric symbols
|~ |. OI |. The hour (12-hour clock) using the locale's alternative
numeric symbols
|~ |. Om |. The month using the locale's alternative numeric symbols
|~ |. OM |. The minutes using the locale's alternative numeric symbols
|~ |. OS |. The seconds using the locale's alternative numeric symbols
|~ |. Ou |. The weekday as a number in the locale's alternative
representation (Monday=1)
|~ |. OU |. The week number of the year (Sunday as the first day of the
week) using the locale's alternative numeric symbols
|~ |. OV |. The week number of the year (Monday as the first day of the
week) as a decimal number (01 -53) using the locale's
alternative numeric symbols. If the week containing January 1
has four or more days in the new year, it is considered
as week 1.  Otherwise, it is considered as week 53 of the
previous year, and the next week is week 1.
|~ |. Ow |. The weekday as a number (Sunday=0) using the locale's
alternative numeric symbols
|~ |. OW |. The week number of the year (Monday as the first day of
the week) using the locale's alternative numeric symbols
|~ |. Oy |. The year without the century using the locale's alternative
numeric symbols
|~ |. p |. The locale's equivalent of the AM/PM designations associated
with a 12-hour clock
|~ |. r |. The time in AM/PM notation
|~ |. R |. The time in 24-hour notation (%H:%M)
|~ |. S |. The second as a decimal number (00 - 61)
|~ |. t |. The tab character
|~ |. T |. The time (%H:%M:%S)
|~ |. u |. The weekday as a decimal number between 1 and 7 (Monday=1)
|~ |. U |. The week number of the year (the first Sunday as the first
day of week 1) as a decimal number (00 - 53)
|~ |. V |. The week number of the year (Monday as the first day of the
week) as a decimal number (00 - 53). If the week containing
January 1 has four or more days in the new year, it is
considered as week 1. Otherwise, it is considered as week 53
of the previous year, and the next week is week 1.
|~ |. w |. The weekday as a decimal number (0 [Sunday] - 6)
|~ |. W |. The week number of the year (the first Monday as the first
day of week 1) as a decimal number (00 - 53)
|~ |. x |. The locale's appropriate date representation
|~ |. X |. The locale's appropriate time representation
|~ |. y |. The year without century as a decimal number (00 - 99)
|~ |. Y |. The year with century as a decimal number
|~ |. Z |. Timezone name or abbreviation. If timezone information is
not available, no character is output.
|~ |. % |. %
|!table|

|2OSU Compatibility|

|^ Essential compatibility with OSU Server Side Includes directives is
provided.  This is intended to ease any transition to WASD, as existing SSI
documents will not need to be changed unless any of the WASD capabilities are
required.  To provide transparent processing of OSU |=..HTMLX| files ensure the
following WASD configuration is in place.

|^ In HTTPD$CONFIG file:

|code|
[AddType]
.HTMLX  text/x-shtml  -  OSU SSI HTML
|!code|

|^ Note that the content description must contain the string "OSU" to activate
some compliancy behaviours.  

|^ In HTTPD$MAP file:

|code|
redirect /*.*.htmlx /*.htmlx?httpd=ssi&__part=*
|!code|

|^ This provides a mechanism for the OSU part-document facility.
(Yes, the "__part" has two leading underscores!)

|0OSU Directives|

|^ The following OSU directives are provided specifically for OSU
compatibility, although there is no reason why most of these may not also be 
deployed in general WASD SSI documents if there is a requirement.  Note that
these are OSU-specifics, other OSU directives are provided by the standard WASD
SSI engine.

|9OSU Compatible Directives|
|table|
|~_ |: Directive|: Description
|~
|~#* |. #begin |/label [|/label||]|
   |. delimit a part-document (see |link|OSU "Part"s||)
|~ |. #config verify=1  |. enable commented-tag trace output
|~ |. #echo accesses |. document access count
|~ |. #echo accesses_ordinal |. document access count
|~ |. #echo getenv="" |. output logical or symbol
|~ |. #echo hw_name |. system hardware name
|~ |. #echo server_name |. HTTPd server host name
|~ |. #echo server_version |. HTTPd software version
|~ |. #echo vms_version |. HTTPd system version of VMS
|~ |. #end |/label| [|/label||]
   |. delimit a part-document (see |link|OSU "Part"s||)
|~ |. #include [file\|virtual]="" part="|/label||"
   |.  include only part of a virtual document
|!table|

|^ If WASD is configured for OSU SSI compatibility the following link provides
an online demonstration as well as further explanation of the OSU SSI engine
using an OSU preprocessor document from the distribution (included within
copyright compliance).

|^+ |link%=|/wasd_root/src/osu/preproc.htmlx|

|^ How do we know WASD is processing it?  Look for the
|/.#echo var="GETENV=SYS$REM_ID"|| towards the end of the document.  It should
indicate |>>."[VARIABLE_DOES_NOT_EXIST!]"| because it's attempting to output a
DECnet-related logical name!

|0OSU "Part"s|

|^ The OSU processor allows for delimited subsections of an |/.#include||d
document, or a URL referenced document for that matter, to be included in the
output.  This is supported, but only for compatibility.  It is only enabled for
".HTMLX" documents and if otherwise used may interact unexpectedly with WASD
SSI flow-control.

|2Script-Generated SSI Documents|

|^ It is possible to have script output passed back through the SSI engine for
markup.  This approach might allow script output to automatically be wrapped
in standard site headers and footers for example.  Essentially the script must
output an SSI-markup response body and include in the otherwise standard CGI
response header a field containing "Script-Control: X-content-handler=SSI". 
The following example in DCL show the essential elements of such a script.

|code|
$ say = "write sys$output"
$ say "Status: 200"
$ say "Script-Control: X-content-handler=SSI""
$ say ""
$ say "<HTML>"
$ say "<HEAD>"
$ say "<TITLE>Example of X-content-handler=SSI</TITLE>"
$ say "</HEAD>"
$ say "<BODY>"
$ say "<!--#include virtual=""/site/header.html"" -->"
$ say "<H1>Example of X-content-handler:SSI</H1>"
$ say "Hi there <!--#echo var=""WWW_REMOTE_HOST"" -->"
$ say "<!--#include virtual=""/site/footer.html"" -->"
$ say "</BODY>"
$ say "</HTML>"
|!code|