1. Syntax

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 ]*