Rexsel Errors

The following is a list of errors that the compiler detects. The error number is not a contiguous set with some numbers ignored, there are historical reasons for this. It is not a complete list as the compiler is being continually updated.

Error detection and recovery is not an exact science and the compiler does its best to report errors. In many cases there are consequential pseuso-errors that arise because of the error recovery process. The first error on the list is usually the genuine one.

In some rare cases the line number associated with the error is not necessarily the line number of the actual error, rather the start line of the block in which the error has occurred.

Note also the line number presented in the error messages may not be accurate for the fragment examples shown because it is taken from a larger piece of source code.

101 — Fatal Error

An unrecoverable error of indeterminate type. Should (!) never happen.

102 — Source File Does Not Exist

File that crexsel is trying to read does not exist. Check that both path and file exists (check correct file extension).

103 — Cannot Read From File

In general this is a permissions problem.

104 — Missing "{" Bracket

Mostly, the only time that this is detected is after the "stylesheet" keyword at the start of the file. For example, the simplistic source

stylesheet

would give the error

**** (104) Missing "{" in line 1 Insert bracket.
105 — Found Unexpected Symbol

An unexpected symbol was found in a keyword. A general "catch all" for something the compiler does not understand. Usually caused by keyword mis-spelling, and illegal keyword for that syntax or a missing quote.

106 — Found Unexpected Symbol Instead Of

Similar to the previous error, but gives what should be in the syntax at that point. For example while entering a XML namespace at the start

stylesheet { version "1.0" xmlns

would give the error (no closing bracket also)

**** (106) Unexpected symbol found instead of "Namespace pair [prefix] [ref]" in "xmlns" in line 5 Check spelling, illegal keyword, or missing quote?
107 — Found Unexpected Expression

Found a quoted expression when expecting a keyword or bracket.

108 — Unknown Value

Produced when a particular value of option is expected. For example the output "method" expects the values "xml", "html" or "text", anything else will cause this error. For example

stylesheet { version "1.0" output { method doc } }

would give the error

**** (108) Illegal value for "method", found 'doc' instead of 'xml', 'html' or 'text' in line 5 Supply correct value.
109 — Already Declared In

When a symbol has already been declared. For example, only one declaration of "version" can be declared

stylesheet { version "1.0" version "1.0" }

would give the error

**** (109) "version" in line 3 is already declared in line 2 Remove duplicate.
110 — Duplicate Symbol

Similar to Error 109 but used when building the symbol table. For example

stylesheet { version "1.0" variable smallText "'Some text'" variable smallText "'Some more text'" }

would give the error

**** (110) "smallText" symbol in 6 already declared in line 4 Remove duplicate or check spelling.
115 — Expected Name

If there is a missing name in a declaration etc. For example

stylesheet { version "1.0" proc { parameter inScript parameter inScriptsDir element "script" { attribute "src" { value "concat($inScriptsDir, $inScript)" } attribute "type" "text/javascript" } } }

would give the error

**** (115) Expected name after "proc" in line 4 Syntax: proc <qname> <block>.

This error also occurs when the variable name is a reserved word.

116 — Could Not Find Variable

If an XPath variable is used within a block has not been declared. For example

stylesheet { version "1.0" proc join { parameter param-1 parameter param-2 value "concat($param-1, $param-3)" } }

would give the error

**** (116) Could not find "param-3" in line 8 Check "param-3" is defined in current block.
118 — Required Element

A missing keyword that is required by the syntax. For example the source

stylesheet { }

would give the error

**** (118) "version" required in element "stylesheet" in line 1 Insert element.
121 — Missing Variable Value

Unlike parameters that can have no default value or (empty) block, variables (constants) must have either the value or block, both of which return a value to assign to the variable. For example

stylesheet { version "1.0" constant valid-param-1 }

would give the error

**** (129) A variable must have either default or enclosed templates in line 4 Supply either default/select or enclosed templates.

This also detects an empty block so that

stylesheet { version "1.0" constant valid-param-1 { } }

would give the error

**** (121) Missing value for "valid-param-1" in line 4 Insert variable/constant value or block.
122 — Missing Test Expression

"when" and "if" conditions require an associated test XPath expression. So for example

when { call common.substring-after-last { with string "substring-after($string, $delimiter)" with delimiter "$delimiter" } }

would give the error

**** (122) Missing test expression in line 9 Insert test.
128 — Cannot Have Both Default And Block

In a variable or parameter declaration it is not valid to have a value declared as well as a block. For example the following

stylesheet { version "1.0" variable smallText "'Some text'" { text "Some other text" } }

would give the error

**** (128) A variable/parameter cannot have default and enclosed templates in line 4 Remove either default/select or enclosed templates.
130 — Missing Match Options

When any expressions are missing from the "match" options ("using", "scope" or "priority". For example

stylesheet { version "1.0" match using "/" scope priority "-1" { element "div" { attribute "id" "concertListAndIndex" } } }

would give the error

**** (130) Missing using/scope/priority expression in line 4 Insert expression.
131 — Parameter Must Be First

When declared in a "proc" or "match" block, parameters should be declared as the first child in that block. For example

proc addHeader { value "concat( '!!! ', $string )" parameter string }

would give the error

**** (131) Parameter "string" in "proc:addHeader" in line 6 must follow declaration. Check order.
136 — Unmatched Brackets

This is a very broad error condition and reports the matching of the \dqp{\{} and \dqp{\}} brackets throughout the stylesheet. Currently it only works at a global level. For example while entering a basic sitemap source file

stylesheet { version "1.0"

would give the error

***** (136) Unmatched brackets in 1 Too many open brackets?

As an aside if there are any keywords, brackets or expressions declared after the closing stylesheet bracket they are ignored.

139 — Found Reserved Word

If a reserved word is used where a QName is expected, for example a proc or a variable name is expected, this will cause an error.

stylesheet { version "1.0" proc text { } }

would give the error

**** (139) Found unexpected reserved word "text" in "proc" in line 4 Check spelling.
140 — invalid expression

Found invalid or null string where there should be expression.

141 — sort statement must follow appropriate statement

"sort" statement must immediately follow declaration.

Copyright 2024 Hugh Field-Richards. All Rights Reserved.