comment
A statement (not to be confused with a
RRexsel comment) injects an XML comment to the output XSLT document.
Syntax
<comment> ::= “comment” <quote> <alphanumeric string> <quote>
Options
None
Elements
None
Examples
For example.
proc func-1 {
comment 'function click(event) {
var mark = event.target;
while ((mark.className != "b") && (mark.nodeName != "BODY")) {
mark = mark.parentNode
}
}'
}
compiles to
<template name="func-1">
<comment><![CDATA[function click(event) {
var mark = event.target;
while ((mark.className != "b") && (mark.nodeName != "BODY")) {
mark = mark.parentNode
}
}]]></comment>
</template>
Note that the use of enclosing quotes is quite important here. In the example above the comment text in the example above is enclosed with
single quotes. This is because of the use of double quote occurring within the text. If required you can use escaped quotes for the same
effect.
proc func-1 {
comment "
function click(event) {
var mark = event.target;
while ((mark.className != \"b\") && (mark.nodeName != \"BODY\")) {
mark = mark.parentNode
}
}"
}
Errors
The primary error is forgetting the correct quotes. To take the above example and replace the enclosing single quotes with double quotes.
proc func-1 {
comment "function click(event) {
var mark = event.target;
while ((mark.className != "b") && (mark.nodeName != "BODY")) {
mark = mark.parentNode
}
}"
}
This would give the errors
**** (106) Unexpected symbol "b" in line 7
Check spelling, no suggestion.
Obviously curable by escaping the internal quotes or replacing the enclosing quotes.
Copyright 2024 Hugh Field-Richards. All Rights Reserved.