Fix #1681 "Caching of form definition is influenced by document id"

- form definition URL was stored into static state
- the URL depends on the ?document parameter
- so the digest was different for every document loaded
Implement #1257 "Properties: support inline value"
Move long Form Runner process definitions inline
Minor: comment
Typo
Part of #715: move xf:switch/xf:case to Scala
Implement #1683 "fr:case: support AVT on selected attribute"
Refactor: move and rename
fr:section: don't statically depend on mode

- part of #1143
- now access mode dynamically from XForms
- xf:case/@selected uses AVT
Fix #1685 "xxf:update="full" is never triggered"

- this probably regressed with the introduction of xxf:dynamic in 0d77bc3e6351f0cbf14d0fbbb53dcf8a6c8d5689
- move ControlsComparator to Scala
- rework ControlsComparator for improved clarity
For #1143: Use of xxf:dynamic doesn't trigger keeping HTML template

- Form Builder was unnecessarily keeping the top-level HTML template
- don't keep template/marks for xxf:dynamic
- don't require a mark in ControlsComparator
- more refactoring of ControlsComparator