XED scripts are found in text files (recommended filename extension ".xed
") having the following syntax:
script
-> [encoding
] [namespace
|include
|command
|if
|foreach
|macro
]*encoding
-> 'encoding'charset_string
';'namespace
-> 'namespace' [prefix_NCName
'=' ]namespace_URI_string
';'include
-> 'include'script_URI_string
';'command
->command_name_NCName
'(' [argument
]* ')' ';'argument
->XPath_expression
|XML_template
if
-> 'if'test
'{'block_contents
'}' [ 'elseif'test
'{'block_contents
'}' ]* [ 'else' '{'block_contents
'}' ]test
->boolean_XPath_expression
block_contents
-> [command
|if
|foreach
]*foreach
-> 'for-each'node_set_XPath_expression
'{'block_contents
'}'macro
->macro_name_NCName
'(' [parameters
] ')' '{'block_contents
'}'parameters
->parameter_name_NCName
[ ','parameter_name_NCName
]*
A string
is a quoted XPath string which may contain XML character entities. Example: 'Hello 'world'!'
.
An XPath_expression
is an XPath 1.0 expression, where the concept of default namespace is supported for element names and where strings may contain XML character entities.
An XML_template
is a literal XML element, possibly containing XPath 1.0 expressions delimited by curly braces ("{ }
"). See Section 10, “XML templates”.