diff --git a/xml/regression.sh b/xml/regression.sh
index dafe4e8e98..7b986aca18 100755
--- a/xml/regression.sh
+++ b/xml/regression.sh
@@ -1,550 +1,567 @@
 #!/bin/sh
 # Copyright 2018 Red Hat, Inc.
 # Author: Jan Pokorny <jpokorny@redhat.com>
 # Part of pacemaker project
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 set -eu
 # $1=reference (can be '-' for stdin), $2=investigated
 # alt.: wdiff, colordiff, ...
 DIFF=${DIFF:-diff}
 DIFFOPTS=${DIFFOPTS--u}
 DIFFPAGER=${DIFFPAGER:-less -LRX}
 # $1=schema, $2=validated
 # alt.: jing -i
 RNGVALIDATOR=${RNGVALIDATOR:-xmllint --noout --relaxng}
+# $1=stylesheet, $2=source
+# alt.: Xalan, saxon (note: only validates reliably with -B)
+_xalan_wrapper() {
+	{ Xalan "$2" "$1" 2>&1 1>&3 \
+	  | sed -e '/^Source tree node.*$/d' \
+	        -e 's|^XSLT message: \(.*\) (Occurred.*)|\1|'; } 3>&1- 1>&2
+}
+# filtered out message: https://bugzilla.redhat.com/show_bug.cgi?id=1577367
+_saxon_wrapper() {
+	{ saxon "-xsl:$1" "-s:$2" -versionmsg:off 2>&1 1>&3 \
+	  | sed -e '/^Cannot find CatalogManager.properties$/d'; } 3>&1- 1>&2
+}
+#_xalan_wrapper() { Xalan $2 $1; }
+XSLTPROCESSOR=${XSLTPROCESSOR:-xsltproc}
+test "${XSLTPROCESSOR}" != Xalan || XSLTPROCESSOR=_xalan_wrapper
+test "${XSLTPROCESSOR}" != saxon || XSLTPROCESSOR=_saxon_wrapper
+
 tests=  # test* names (should go first) here will become preselected default
 
 #
 # commons
 #
 
 emit_result() {
 	_er_howmany=${1:?}  # how many errors (0/anything else incl. strings)
 	_er_subject=${2:?}
 	_er_prefix=${3-}
 
 	test -z "${_er_prefix}" || _er_prefix="${_er_prefix}: "
 
 	if test "${_er_howmany}" = 0; then
 		printf "%s%s finished OK\n" "${_er_prefix}" "${_er_subject}"
 	else
 		printf "%s%s encountered ${_er_howmany} errors\n" \
 		       "${_er_prefix}" "${_er_subject}"
 	fi
 }
 
 emit_error() {
 	_ee_msg=${1:?}
 	printf "%s\n" "${_ee_msg}" >&2
 }
 
 # returns 1 + floor of base 2 logaritm for _lo0r_i in 1...255,
 # or 0 for _lo0r_i = 0
 log2_or_0_return() {
 	_lo0r_i=${1:?}
 	return $(((!(_lo0r_i >> 1) && _lo0r_i) * 1 \
                 + (!(_lo0r_i >> 2) && _lo0r_i & (1 << 1)) * 2 \
                 + (!(_lo0r_i >> 3) && _lo0r_i & (1 << 2)) * 3 \
                 + (!(_lo0r_i >> 4) && _lo0r_i & (1 << 3)) * 4 \
                 + (!(_lo0r_i >> 5) && _lo0r_i & (1 << 4)) * 5 \
                 + (!(_lo0r_i >> 6) && _lo0r_i & (1 << 5)) * 6 \
                 + (!(_lo0r_i >> 7) && _lo0r_i & (1 << 6)) * 7 \
                 + !!(_lo0r_i >> 7) * 7 ))
 }
 
 # rough addition of two base 2 logarithms
 log2_or_0_add() {
 	_lo0a_op1=${1:?}
 	_lo0a_op2=${2:?}
 
 	if test ${_lo0a_op1} -gt ${_lo0a_op2}; then
 		return ${_lo0a_op1}
 	elif test ${_lo0a_op2} -gt ${_lo0a_op1}; then
 		return ${_lo0a_op2}
 	elif test ${_lo0a_op1} -gt 0; then
 		return $((_lo0a_op1 + 1))
 	else
 		return ${_lo0a_op1}
 	fi
 }
 
 #
 # test phases
 #
 
 # -r ... whether to remove referential files as well
 # stdin: input file per line
 test_cleaner() {
 	_tc_cleanref=0
 
 	while test $# -gt 0; do
 		case "$1" in
 		-r) _tc_cleanref=1;;
 		esac
 		shift
 	done
 
 	while read _tc_origin; do
 		_tc_origin=${_tc_origin%.*}
 		rm -f "${_tc_origin}.up" "${_tc_origin}.up.err"
 		rm -f "$(dirname "${_tc_origin}")/.$(basename "${_tc_origin}").up"
 		test ${_tc_cleanref} -eq 0 \
 		  || rm -f "${_tc_origin}.ref" "${_tc_origin}.ref.err"
 	done
 }
 
 test_selfcheck() {
 	_tsc_template=
 	_tsc_validator=
 
 	while test $# -gt 0; do
 		case "$1" in
 		-o=*) _tsc_template="${1#-o=}";;
 		esac
 		shift
 	done
 	_tsc_validator="${_tsc_template:?}"
 	_tsc_validator="cibtr-${_tsc_validator%%.*}.rng"
 	_tsc_template="upgrade-${_tsc_template}.xsl"
 
 	# check schema (sub-grammar) for custom transformation mapping alone
 	${RNGVALIDATOR} 'http://relaxng.org/relaxng.rng' "${_tsc_validator}"
 	# check the overall XSLT per the main grammar + said sub-grammar
 	${RNGVALIDATOR} "xslt_${_tsc_validator}" "${_tsc_template}"
 }
 
 test_explanation() {
 	_tsc_template=
 
 	while test $# -gt 0; do
 		case "$1" in
 		-o=*) _tsc_template="upgrade-${1#-o=}.xsl";;
 		esac
 		shift
 	done
 
-	xsltproc upgrade-detail.xsl "${_tsc_template}"
+	${XSLTPROCESSOR} upgrade-detail.xsl "${_tsc_template}"
 }
 
 # stdout: filename of the transformed file
 test_runner_upgrade() {
 	_tru_template=${1:?}
 	_tru_source=${2:?}  # filename
 	_tru_mode=${3:?}  # extra modes wrt. "referential" outcome, see below
 
 	_tru_ref="${_tru_source%.*}.ref"
         { test "$((_tru_mode & (1 << 0)))" -ne 0 \
 	  || test -f "${_tru_ref}.err"; } \
 	  && _tru_ref_err="${_tru_ref}.err" || _tru_ref_err=/dev/null
 	_tru_target="${_tru_source%.*}.up"
 	_tru_target_err="${_tru_target}.err"
 
 	if test $((_tru_mode & (1 << 2))) -eq 0; then
-		xsltproc "${_tru_template}" "${_tru_source}" \
+		${XSLTPROCESSOR} "${_tru_template}" "${_tru_source}" \
 		  > "${_tru_target}" 2> "${_tru_target_err}" \
 		  || { _tru_ref=$?; echo "${_tru_target_err}"
 		       return ${_tru_ref}; }
 	else
 		# when -B (deblanked outcomes handling) requested, we:
 		# - drop blanks from the source XML
 		#   (effectively emulating pacemaker handling)
 		# - re-drop blanks from the XSLT outcome,
 		#   which is compared with referential outcome
 		#   processed with even greedier custom deblanking
 		#   (extraneous inter-element whitespace like blank
 		#   lines will not get removed otherwise, see lower)
 		xmllint --noblanks "${_tru_source}" \
-		  | xsltproc "${_tru_template}" - \
+		  | ${XSLTPROCESSOR} "${_tru_template}" - \
 		  > "${_tru_target}" 2> "${_tru_target_err}" \
 		  || { _tru_ref=$?; echo "${_tru_target_err}"
 		       return ${_tru_ref}; }
 		# reusing variable no longer needed
 		_tru_template="$(dirname "${_tru_target}")"
 		_tru_template="${_tru_template}/.$(basename "${_tru_target}")"
 		mv "${_tru_target}" "${_tru_template}"
-		xsltproc - "${_tru_template}" > "${_tru_target}" <<-EOF
+		${XSLTPROCESSOR} - "${_tru_template}" > "${_tru_target}" <<-EOF
 	<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 	<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"/>
 	<xsl:template match="@*|*|comment()|processing-instruction()">
 	  <xsl:copy>
 	    <xsl:apply-templates select="@*|node()"/>
 	  </xsl:copy>
 	</xsl:template>
 	<xsl:template match="text()">
 	  <xsl:value-of select="normalize-space(.)"/>
 	</xsl:template>
 	</xsl:stylesheet>
 EOF
 	fi
 
 	# only respond with the flags except for "-B", i.e., when both:
 	# - _tru_mode non-zero
 	# - "-B" in _tru_mode is zero (hence non-zero when flipped with XOR)
 	if test "$((_tru_mode * ((_tru_mode ^ (1 << 2)) & (1 << 2))))" -ne 0; then
 		if test $((_tru_mode & (1 << 0))) -ne 0; then
 			cp -a "${_tru_target}" "${_tru_ref}"
 			cp -a "${_tru_target_err}" "${_tru_ref_err}"
 		fi
 		if test $((_tru_mode & (1 << 1))) -ne 0; then
 			"${DIFF}" ${DIFFOPTS} "${_tru_source}" "${_tru_ref}" \
 			  | ${DIFFPAGER} >&2
 			if test $? -ne 0; then
 				printf "\npager failure\n" >&2
 				return 1
 			fi
 			printf '\nIs comparison OK? ' >&2
 			if read _tru_answer </dev/tty; then
 				case "${_tru_answer}" in
 				y|yes) ;;
 				*) echo "Answer not 'y' nor 'yes'" >&2; return 1;;
 				esac
 			else
 				return 1
 			fi
 		fi
 	elif test -f "${_tru_ref}" && test -e "${_tru_ref_err}"; then
 		{ test "$((_tru_mode & (1 << 2)))" -eq 0 && cat "${_tru_ref}" \
-		    || xsltproc - "${_tru_ref}" <<-EOF
+		    || ${XSLTPROCESSOR} - "${_tru_ref}" <<-EOF
 	<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 	<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"/>
 	<xsl:template match="@*|*|comment()|processing-instruction()">
 	  <xsl:copy>
 	    <xsl:apply-templates select="@*|node()"/>
 	  </xsl:copy>
 	</xsl:template>
 	<xsl:template match="text()">
 	  <xsl:value-of select="normalize-space(.)"/>
 	</xsl:template>
 	</xsl:stylesheet>
 EOF
 		} \
 		  | "${DIFF}" ${DIFFOPTS} - "${_tru_target}" >&2 \
 		  && "${DIFF}" ${DIFFOPTS} "${_tru_ref_err}" \
 		       "${_tru_target_err}" >&2
 		if test $? -ne 0; then
 			emit_error "Outputs differ from referential ones"
 			echo "/dev/null"
 			return 1
 		fi
 	else
 		emit_error "Referential file(s) missing: ${_tru_ref}"
 		echo "/dev/null"
 		return 1
 	fi
 
 	echo "${_tru_target}"
 }
 
 test_runner_validate() {
 	_trv_schema=${1:?}
 	_trv_target=${2:?}  # filename
 
 	if ! ${RNGVALIDATOR} "${_trv_schema}" "${_trv_target}" \
 	    2>/dev/null; then
 		${RNGVALIDATOR} "${_trv_schema}" "${_trv_target}"
 	fi
 }
 
 # -o= ... which conventional version to deem as the transform origin
 # -t= ... which conventional version to deem as the transform target
 # -B
 # -D
 # -G  ... see usage
 # stdin: input file per line
 test_runner() {
 	_tr_mode=0
 	_tr_ret=0
 	_tr_schema_o=
 	_tr_schema_t=
 	_tr_target=
 	_tr_template=
 
 	while test $# -gt 0; do
 		case "$1" in
 		-o=*) _tr_template="upgrade-${1#-o=}.xsl"
 		      _tr_schema_o="pacemaker-${1#-o=}.rng";;
 		-t=*) _tr_schema_t="pacemaker-${1#-t=}.rng";;
 		-G) _tr_mode=$((_tr_mode | (1 << 0)));;
 		-D) _tr_mode=$((_tr_mode | (1 << 1)));;
 		-B) _tr_mode=$((_tr_mode | (1 << 2)));;
 		esac
 		shift
 	done
 
 	if ! test -f "${_tr_schema_o:?}" || ! test -f "${_tr_schema_t:?}"; then
 		emit_error "Origin and/or target schema missing, rerun make"
 		return 1
 	fi
 
 	while read _tr_origin; do
 		printf '%-60s' "${_tr_origin}... "
 
 		# pre-validate
 		if ! test_runner_validate "${_tr_schema_o}" "${_tr_origin}"; then
 			_tr_ret=$((_tr_ret + 1)); echo "E:pre-validate"; continue
 		fi
 
 		# upgrade
 		if ! _tr_target=$(test_runner_upgrade "${_tr_template}" \
 		                 "${_tr_origin}" "${_tr_mode}"); then
 			_tr_ret=$((_tr_ret + 1));
 			test -n "${_tr_target}" || break
 			echo "E:upgrade"
 			test -s "${_tr_target}" \
 			  && { echo ---; cat "${_tr_target}" || :; echo ---; }
 			continue
 		fi
 
 		# post-validate
 		if ! test_runner_validate "${_tr_schema_t}" "${_tr_target}"; then
 			_tr_ret=$((_tr_ret + 1)); echo "E:post-validate"; continue
 		fi
 
 		echo "OK"
 	done
 
 	log2_or_0_return ${_tr_ret}
 }
 
 #
 # particular test variations
 # stdin: granular test specification(s) if any
 #
 
 test2to3() {
 	_t23_pattern=
 
 	while read _t23_spec; do
 		_t23_spec=${_t23_spec%.xml}
 		_t23_spec=${_t23_spec%\*}
 		_t23_pattern="${_t23_pattern} -name ${_t23_spec}*.xml -o"
 	done
 	test -z "${_t23_pattern}" || _t23_pattern="( ${_t23_pattern%-o} )"
 
 	find test-2 -name '*.xml' ${_t23_pattern} -print | env LC_ALL=C sort \
 	  | { case " $* " in
 	      *\ -C\ *) test_cleaner;;
 	      *\ -S\ *) test_selfcheck -o=2.10;;
 	      *\ -X\ *) test_explanation -o=2.10;;
 	      *) test_runner -o=2.10 -t=3.0 "$@" || return $?;;
 	      esac; }
 }
 tests="${tests} test2to3"
 
 # -B
 # -D
 # -G  ... see usage
 cts_scheduler() {
 	_tcp_mode=0
 	_tcp_ret=0
 	_tcp_validatewith=
 	_tcp_schema_o=
 	_tcp_schema_t=
 	_tcp_template=
 
 	find ../cts/scheduler -name '*.xml' -print | env LC_ALL=C sort \
 	  | { case " $* " in
 	      *\ -C\ *) test_cleaner -r;;
 	      *\ -S\ *) emit_result "not implemented" "option -S";;
 	      *\ -X\ *) emit_result "not implemented" "option -X";;
 	      *)
 		while test $# -gt 0; do
 			case "$1" in
 			-G) _tcp_mode=$((_tcp_mode | (1 << 0)));;
 			-D) _tcp_mode=$((_tcp_mode | (1 << 1)));;
 			-B) _tcp_mode=$((_tcp_mode | (1 << 2)));;
 			esac
 			shift
 		done
 		while read _tcp_origin; do
-			_tcp_validatewith=$(xsltproc - "${_tcp_origin}" <<-EOF
+			_tcp_validatewith=$(${XSLTPROCESSOR} - "${_tcp_origin}" <<-EOF
 	<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 	<xsl:output method="text" encoding="UTF-8"/>
 	<xsl:template match="/">
 	  <xsl:choose>
 	    <xsl:when test="starts-with(cib/@validate-with, 'pacemaker-')">
 	      <xsl:variable name="Version" select="substring-after(cib/@validate-with, 'pacemaker-')"/>
 	      <xsl:choose>
 	        <xsl:when test="contains(\$Version, '.')">
 	          <xsl:value-of select="substring-before(\$Version, '.')"/>
 	        </xsl:when>
 	        <xsl:otherwise>
 	          <xsl:value-of select="cib/@validate-with"/>
 	        </xsl:otherwise>
 	      </xsl:choose>
 	    </xsl:when>
 	    <xsl:otherwise>
 	     <xsl:value-of select="cib/@validate-with"/>
 	    </xsl:otherwise>
 	  </xsl:choose>
 	</xsl:template>
 	</xsl:stylesheet>
 EOF
 )
 			_tcp_schema_t=${_tcp_validatewith}
 			case "${_tcp_validatewith}" in
 			1) _tcp_schema_o=1.3;;
 			2) _tcp_schema_o=2.10;;
 			# only for gradual refinement as upgrade-2.10.xsl under
 			# active development, move to 3.x when schema v4 emerges
 			3) _tcp_schema_o=2.10
 			   _tcp_schema_t=2;;
 			*) emit_error \
 			   "need to skip ${_tcp_origin} (schema: ${_tcp_validatewith})"
 			   continue;;
 			esac
 			_tcp_template="upgrade-${_tcp_schema_o}.xsl"
 			_tcp_schema_t="pacemaker-$((_tcp_schema_t + 1)).0.rng"
 			test "${_tcp_schema_o%%.*}" = "${_tcp_validatewith}" \
 			  && _tcp_schema_o="pacemaker-${_tcp_schema_o}.rng" \
 			  || _tcp_schema_o="${_tcp_schema_t}"
 
 			# pre-validate
 			if test "${_tcp_schema_o}" != "${_tcp_schema_t}" \
 			  && ! test_runner_validate "${_tcp_schema_o}" "${_tcp_origin}"; then
 				_tcp_ret=$((_tcp_ret + 1)); echo "E:pre-validate"; continue
 			fi
 
 			# upgrade
 			test "$((_tcp_mode & (1 << 0)))" -ne 0 \
 			  || ln -fs "$(pwd)/${_tcp_origin}" "${_tcp_origin%.*}.ref"
 			if ! _tcp_target=$(test_runner_upgrade "${_tcp_template}" \
 			                   "${_tcp_origin}" "${_tcp_mode}"); then
 				_tcp_ret=$((_tcp_ret + 1));
 				test -n "${_tcp_target}" || break
 				echo "E:upgrade"
 				test -s "${_tcp_target}" \
 				  && { echo ---; cat "${_tcp_target}" || :; echo ---; }
 				continue
 			fi
 			test "$((_tcp_mode & (1 << 0)))" -ne 0 \
 			  || rm -f "${_tcp_origin%.*}.ref"
 
 			# post-validate
 			if ! test_runner_validate "${_tcp_schema_t}" "${_tcp_target}"; then
 				_tcp_ret=$((_tcp_ret + 1)); echo "E:post-validate"; continue
 			fi
 
 			test "$((_tcp_mode & (1 << 0)))" -eq 0 \
 			  || mv "${_tcp_target}" "${_tcp_origin}"
 		done; log2_or_0_return ${_tcp_ret};;
 	      esac; }
 }
 tests="${tests} cts_scheduler"
 
 #
 # "framework"
 #
 
 # option-likes ... options to be passed down
 # argument-likes ... drives a test selection
 test_suite() {
 	_ts_pass=
 	_ts_select=
 	_ts_select_full=
 	_ts_test_specs=
 	_ts_global_ret=0
 	_ts_ret=0
 
 	while test $# -gt 0; do
 		case "$1" in
 		-) while read _ts_spec; do _ts_select="${_ts_spec}@$1"; done;;
 		-*) _ts_pass="${_ts_pass} $1";;
 		*) _ts_select_full="${_ts_select_full}@$1"
 		   _ts_select="${_ts_select}@${1%%/*}";;
 		esac
 		shift
 	done
 	_ts_select="${_ts_select}@"
 	_ts_select_full="${_ts_select_full}@"
 
 	for _ts_test in ${tests}; do
 
 		while true; do
 			case "${_ts_select}" in
 			*@${_ts_test}@*)
 			_ts_select="${_ts_select%@${_ts_test}@*}"\
 "@${_ts_select#*@${_ts_test}@}"
 			;;
 			@) case "${_ts_test}" in test*) break;; *) continue 2;; esac
 			;;
 			*) continue 2;;
 			esac
 		done
 
 		_ts_test_specs=
 		while true; do
 			case "${_ts_select_full}" in
 			*@${_ts_test}/*)
 				_ts_test_full="${_ts_test}/${_ts_select_full#*@${_ts_test}/}"
 				_ts_test_full="${_ts_test_full%%@*}"
 				_ts_select_full="${_ts_select_full%@${_ts_test_full}@*}"\
 "@${_ts_select_full#*@${_ts_test_full}@}"
 				_ts_test_specs="${_ts_test_specs} ${_ts_test_full#*/}"
 			;;
 			*)
 			break
 			;;
 			esac
 		done
 
 		for _ts_test_spec in ${_ts_test_specs}; do
 			printf '%s\n' "${_ts_test_spec}"
 		done | "${_ts_test}" ${_ts_pass} || _ts_ret=$?
 
 		test ${_ts_ret} = 0 \
 		  && emit_result ${_ts_ret} "${_ts_test}" \
 		  || emit_result "at least 2^$((_ts_ret - 1))" "${_ts_test}"
 		log2_or_0_add ${_ts_global_ret} ${_ts_ret}
 		_ts_global_ret=$?
 	done
 	if test "${_ts_select}" != @; then
 		emit_error "Non-existing test(s):$(echo "${_ts_select}" \
 		                                   | tr '@' ' ')"
 		log2_or_0_add ${_ts_global_ret} 1 || _ts_global_ret=$?
 	fi
 
 	return ${_ts_global_ret}
 }
 
 # NOTE: big letters are dedicated for per-test-set behaviour,
 #       small ones for generic/global behaviour
 usage() {
 	printf '%s\n  %s\n  %s\n  %s\n  %s\n  %s\n  %s\n  %s\n  %s\n  %s\n' \
 	    "usage: $0 [-{B,C,D,G,S,X}]* [-|{${tests## }}*]" \
 	    "- when no suites (arguments) provided, \"test*\" ones get used" \
 	    "- with '-' suite specification the actual ones grabbed on stdin" \
 	    "- use '-B' to run validate-only check suppressing blanks first" \
 	    "- use '-C' to only cleanup ephemeral byproducts" \
 	    "- use '-D' to review originals vs. \"referential\" outcomes" \
 	    "- use '-G' to generate \"referential\" outcomes" \
 	    "- use '-S' for template self-check (requires net access)" \
 	    "- use '-X' to show explanatory details about the upgrade" \
 	    "- test specification can be granular, e.g. 'test2to3/022'"
 }
 
 main() {
 	_main_pass=
 	_main_bailout=0
 	_main_ret=0
 
 	while test $# -gt 0; do
 		case "$1" in
 		-h) usage; exit;;
 		-C|-G|-S|-X) _main_bailout=1;;
 		esac
 		_main_pass="${_main_pass} $1"
 		shift
 	done
 
 	test_suite ${_main_pass} || _main_ret=$?
 	test ${_main_bailout} -eq 1 && return ${_main_ret} \
 	  || test_suite -C ${_main_pass} >/dev/null || true
 	test ${_main_ret} = 0 && emit_result ${_main_ret} "Overall suite" \
 	  || emit_result "at least 2^$((_main_ret - 1))" "Overall suite"
 
 	return ${_main_ret}
 }
 
 main "$@"
diff --git a/xml/upgrade-2.10.xsl b/xml/upgrade-2.10.xsl
index fdcf1c8dcb..29c17d6a73 100644
--- a/xml/upgrade-2.10.xsl
+++ b/xml/upgrade-2.10.xsl
@@ -1,1798 +1,1799 @@
 <!--
  Copyright 2018 Red Hat, Inc.
  Author: Jan Pokorny <jpokorny@redhat.com>
  Part of pacemaker project
  SPDX-License-Identifier: GPL-2.0-or-later
  -->
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:cibtr="http://clusterlabs.org/ns/pacemaker/cibtr-2">
+                xmlns:cibtr="http://clusterlabs.org/ns/pacemaker/cibtr-2"
+                exclude-result-prefixes="cibtr">
 <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
 
 <xsl:param name="cib-min-ver" select="'3.0'"/>
 
 <!--
 
  HELPER DEFINITIONS
 
  -->
 
 <cibtr:map>
 
   <!--
    Target tag:     cluster_property_set
    Object:         ./nvpair/@name
    Selector ctxt:  ./nvpair/@value
    Move ctxt:      op_defaults ~ /cib/configuration/op_defaults
                    rsc_defaults ~ /cib/configuration/rsc_defaults
    -->
   <cibtr:table for="cluster-properties" msg-prefix="Cluster properties"
                where-cases="op_defaults|rsc_defaults">
     <cibtr:replace what="cluster-infrastructure"
                    with=""
                    in-case-of="heartbeat|openais|classic openais|classic openais (with plugin)|cman"
                    msg-extra="corosync (2+) infrastructure can be used instead, though the value is not of significance"/>
 
     <cibtr:replace what="cluster_recheck_interval"
                    with="cluster-recheck-interval"/>
     <cibtr:replace what="dc_deadtime"
                    with="dc-deadtime"/>
 
     <cibtr:replace what="default-action-timeout"
                    with="timeout"
                    where="op_defaults"/>
     <cibtr:replace what="default_action_timeout"
                    with="timeout"
                    where="op_defaults"/>
 
     <cibtr:replace what="default-migration-threshold"
                    with=""
                    msg-extra="migration-threshold in rsc_defaults can be configured instead"/>
     <cibtr:replace what="default_migration_threshold"
                    with=""
                    msg-extra="migration-threshold in rsc_defaults can be configured instead"/>
 
     <cibtr:replace what="default-resource-stickiness"
                    with="resource-stickiness"
                    where="rsc_defaults"/>
     <cibtr:replace what="default_resource_stickiness"
                    with="resource-stickiness"
                    where="rsc_defaults"/>
 
     <cibtr:replace what="default-resource-failure-stickiness"
                    with="migration-threshold"
                    where="rsc_defaults"
                    in-case-of="-INFINITY"
                    redefined-as="1"/>
     <cibtr:replace what="default-resource-failure-stickiness"
                    with=""
                    msg-extra="migration-threshold in rsc_defaults can be configured instead"/>
     <cibtr:replace what="default_resource_failure_stickiness"
                    with="migration-threshold"
                    where="rsc_defaults"
                    in-case-of="-INFINITY"
                    redefined-as="1"/>
     <cibtr:replace what="default_resource_failure_stickiness"
                    with=""
                    msg-extra="migration-threshold in rsc_defaults can be configured instead"/>
 
     <cibtr:replace what="election_timeout"
                    with="election-timeout"/>
     <cibtr:replace what="expected-quorum-votes"
                    with=""
                    msg-extra="corosync (2+) infrastructure tracks quorum on its own"/>
 
     <cibtr:replace what="is-managed-default"
                    with="is-managed"
                    where="rsc_defaults"/>
     <cibtr:replace what="is_managed_default"
                    with="is-managed"
                    where="rsc_defaults"/>
     <cibtr:replace what="no_quorum_policy"
                    with="no-quorum-policy"/>
 
     <cibtr:replace what="notification-agent"
                    with=""
                    msg-extra="standalone alerts can be configured instead"/>
     <cibtr:replace what="notification-recipient"
                    with=""
                    msg-extra="standalone alerts can be configured instead"/>
 
     <cibtr:replace what="remove_after_stop"
                    with="remove-after-stop"/>
     <cibtr:replace what="shutdown_escalation"
                    with="shutdown-escalation"/>
     <cibtr:replace what="startup_fencing"
                    with="startup-fencing"/>
     <cibtr:replace what="stonith_action"
                    with="stonith-action"/>
     <cibtr:replace what="stonith_enabled"
                    with="stonith-enabled"/>
     <cibtr:replace what="stop_orphan_actions"
                    with="stop-orphan-actions"/>
     <cibtr:replace what="stop_orphan_resources"
                    with="stop-orphan-resources"/>
     <cibtr:replace what="symmetric_cluster"
                    with="symmetric-cluster"/>
     <cibtr:replace what="transition_idle_timeout"
                    with="cluster-delay"/>
   </cibtr:table>
 
   <!--
    Target tag:     node
    Object:         ./@*
    Selector ctxt:  ./@*
    Move ctxt:      N/A
    -->
   <cibtr:table for="cluster-node" msg-prefix="Cluster node">
     <cibtr:replace what="type"
                    with="type"
                    in-case-of="normal"
                    redefined-as="member"/>
   </cibtr:table>
 
   <!--
    Target tag:     primitive
                    template
    Object:         ./instance_attributes/nvpair/@name
    Selector ctxt:  N/A
    Move ctxt:      N/A
    -->
   <cibtr:table for="resource-instance-attributes" msg-prefix="Resource instance_attributes">
     <cibtr:replace what="pcmk_arg_map"
                    with=""/>
     <!-- simplified as pcmk_arg_map can encode multiple
          comma-separated pairs (everything would be dropped then,
          except for a single dangling case: "port" coming first) -->
     <cibtr:replace what="pcmk_arg_map"
                    with="pcmk_host_argument"
                    in-case-of-droppable-prefix="port:"/>
 
     <cibtr:replace what="pcmk_list_cmd"
                    with="pcmk_list_action"/>
     <cibtr:replace what="pcmk_monitor_cmd"
                    with="pcmk_monitor_action"/>
     <cibtr:replace what="pcmk_off_cmd"
                    with="pcmk_off_action"/>
     <cibtr:replace what="pcmk_on_cmd"
                    with="pcmk_on_action"/>
     <cibtr:replace what="pcmk_reboot_cmd"
                    with="pcmk_reboot_action"/>
     <cibtr:replace what="pcmk_status_cmd"
                    with="pcmk_status_action"/>
   </cibtr:table>
 
   <!--
    Target tag:     primitive
                    template
    Object:         ./operations/op/@*
                    ./operations/op/meta_attributes/nvpair/@name
    Selector ctxt:  ./operations/op/@name
    Move ctxt:      meta_attributes ~ ./meta_attributes/nvpair
    -->
   <cibtr:table for="resources-operation" msg-prefix="Resources-operation"
                where-cases="meta_attributes">
     <cibtr:replace what="requires"
                    with=""
                    msg-extra="only start/promote operation taken into account"/>
     <cibtr:replace what="requires"
                    with="requires"
                    in-case-of="start|promote"
                    where="meta_attributes"/>
   </cibtr:table>
 
   <!--
    Target tag:     rsc_colocation
    Object:         ./@*
    Selector ctxt:  N/A
    Move ctxt:      N/A
    -->
   <cibtr:table for="constraints-colocation" msg-prefix="Constraints-colocation">
     <cibtr:replace what="score-attribute"
                    with=""
                    msg-extra="was actually never in effect"/>
     <cibtr:replace what="score-attribute-mangle"
                    with=""
                    msg-extra="was actually never in effect"/>
   </cibtr:table>
 
 </cibtr:map>
 
 <xsl:variable name="MapClusterProperties"
               select="document('')/xsl:stylesheet
                         /cibtr:map/cibtr:table[
                           @for = 'cluster-properties'
                         ]"/>
 
 <xsl:variable name="MapClusterNode"
               select="document('')/xsl:stylesheet
                         /cibtr:map/cibtr:table[
                           @for = 'cluster-node'
                         ]"/>
 
 <xsl:variable name="MapResourceInstanceAttributes"
               select="document('')/xsl:stylesheet
                         /cibtr:map/cibtr:table[@for = 'resource-instance-attributes'
                       ]"/>
 
 <xsl:variable name="MapResourcesOperation"
               select="document('')/xsl:stylesheet
                         /cibtr:map/cibtr:table[
                           @for = 'resources-operation'
                         ]"/>
 
 <xsl:variable name="MapConstraintsColocation"
               select="document('')/xsl:stylesheet
                         /cibtr:map/cibtr:table[
                           @for = 'constraints-colocation'
                         ]"/>
 
 <!--
 
  GENERIC UTILITIES
 
  -->
 
 <!--
  Plain identity template
 
  Merely implicit-context-driven, no arguments.
  -->
 <xsl:template name="HelperIdentity">
   <xsl:copy>
     <xsl:apply-templates select="@*|node()"/>
   </xsl:copy>
 </xsl:template>
 
 <!--
  Emit an message about the replacement, sanity checking the source definitions
 
  Merely parameter driven, no implicit context taken into account:
  - Context: optional message prefix
  - Replacement: selected subset of cibtr:map's leaves
                 (it's considered a hard error if consists of more than 1 item)
  -->
 <xsl:template name="MapMsg">
   <xsl:param name="Context" select="''"/>
   <xsl:param name="Replacement"/>
   <xsl:choose>
     <xsl:when test="not($Replacement)"/>
     <xsl:when test="count($Replacement) != 1">
       <xsl:message terminate="yes">
         <xsl:value-of select="concat('INTERNAL ERROR:',
                                      $Replacement/../@msg-prefix,
                                      ': count($Replacement) != 1',
                                      ' does not hold (',
                                      count($Replacement), ')')"/>
       </xsl:message>
     </xsl:when>
     <xsl:otherwise>
       <xsl:variable name="MsgPrefix" select="concat(
                                                ($Replacement|$Replacement/..)
                                                  /@msg-prefix, ': '
                                              )"/>
       <xsl:message>
         <xsl:value-of select="$MsgPrefix"/>
         <xsl:if test="$Context">
           <xsl:value-of select="concat($Context, ': ')"/>
         </xsl:if>
         <xsl:choose>
           <xsl:when test="string($Replacement/@with)">
             <xsl:choose>
               <xsl:when test="string($Replacement/@where)">
                 <xsl:if test="not(
                                 contains(
                                   concat('|', $Replacement/../@where-cases, '|'),
                                   concat('|', $Replacement/@where, '|')
                                 )
                               )">
                   <xsl:message terminate="yes">
                     <xsl:value-of select="concat('INTERNAL ERROR:',
                                                  $Replacement/../@msg-prefix,
                                                  ': $Replacement/@where (',
                                                  $Replacement/@where, ') not in ',
                                                  concat('|',
                                                  $Replacement/../@where-cases,
                                                  '|'))"/>
                   </xsl:message>
                 </xsl:if>
                 <xsl:value-of select="concat('moving ', $Replacement/@what,
                                              ' under ', $Replacement/@where)"/>
               </xsl:when>
               <xsl:when test="$Replacement/@with = $Replacement/@what">
                 <xsl:value-of select="concat('keeping ', $Replacement/@what)"/>
               </xsl:when>
               <xsl:otherwise>
                 <xsl:value-of select="concat('renaming ', $Replacement/@what)"/>
               </xsl:otherwise>
             </xsl:choose>
             <xsl:value-of select="concat(' as ', $Replacement/@with)"/>
             <xsl:if test="$Replacement/@where">
               <xsl:value-of select="' unless already defined there'"/>
             </xsl:if>
           </xsl:when>
           <xsl:otherwise>
             <xsl:value-of select="concat('dropping ', $Replacement/@what)"/>
           </xsl:otherwise>
         </xsl:choose>
         <xsl:if test="string($Replacement/@redefined-as)">
           <xsl:value-of select="concat(', redefined as ',
                                        $Replacement/@redefined-as)"/>
           <xsl:if test="$Replacement/@in-case-of">
             <xsl:value-of select="','"/>
           </xsl:if>
         </xsl:if>
         <xsl:choose>
           <xsl:when test="string($Replacement/@in-case-of)">
             <xsl:value-of select="concat(' for matching ',
                                          $Replacement/@in-case-of)"/>
           </xsl:when>
           <xsl:when test="$Replacement/@in-case-of">
             <xsl:value-of select="' for matching &quot;empty string&quot;'"/>
           </xsl:when>
           <xsl:when test="$Replacement/@in-case-of-droppable-prefix">
             <xsl:value-of select="concat(' for matching ',
                                     $Replacement/@in-case-of-droppable-prefix,
                                     ' prefix that will, meanwhile, get dropped'
                                   )"/>
           </xsl:when>
         </xsl:choose>
       </xsl:message>
       <xsl:if test="$Replacement/@msg-extra">
         <xsl:message>
           <xsl:value-of select="concat($MsgPrefix, '... ',
                                        $Replacement/@msg-extra)"/>
         </xsl:message>
       </xsl:if>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
 
 <!--
  Produce a denormalized space if not present in the input (cf. trick A.)
 
  Merely parameter driven, no implicit context taken into account:
  - Source: input selection or result tree fragment to evaluate
  - ResultTreeFragment: optional self-explanatory flag related to Source
  -->
 <xsl:template name="HelperDenormalizedSpace">
   <xsl:param name="Source"/>
   <xsl:param name="ResultTreeFragment" select="false()"/>
   <xsl:param name="InnerSimulation" select="false()"/>
   <xsl:choose>
     <xsl:when test="not($ResultTreeFragment)">
       <!-- intention here is that immediately surrounding text (mostly expected
            to be just indenting whitespace) and comments will be preserved;
            in case no denormalized space is present, " " is injected -->
       <xsl:variable name="ExistingSpace"
                     select="$Source/preceding-sibling::node()[
                               (
                                 self::comment()
                                 or
                                 self::text()
                               )
                               and
                               generate-id(following-sibling::*[1])
                               = generate-id($Source)
                             ]"/>
       <xsl:copy-of select="$ExistingSpace"/>
       <xsl:if test="not(
                       $ExistingSpace/self::text()[
                         normalize-space(.) != string(.)
                       ]
                     ) and $InnerSimulation">
         <xsl:text> </xsl:text>
       </xsl:if>
     </xsl:when>
     <xsl:when test="normalize-space($Source)
                     != string($Source)">
       <xsl:text> </xsl:text>
     </xsl:when>
   </xsl:choose>
 </xsl:template>
 
 <!--
 
  TRANSFORMATION HELPERS
 
  considerations, limitations, etc.:
  1. the transformations tries to preserve as much of the original XML
     as possible, incl. whitespace text/indentation and comments, but
     at times (corner cases of tricks A. + B. below), this needs to be
     sacrificed, e.g., distorting nice indentation, hence if the
     perfection is the goal:
     - user of the transformation can feed the minimized version of
       the XML (no denormalized/any white-space present)
     - user of the transformation can (re-)pretty-print the outcome
       afterwards
 
  tricks and conventions used:
  A. callable templates only return Result Tree Fragments, which means
     the only operations allowed are those looking at the underlying,
     virtual node-set, and since we need to discern their non-void
     production (i.e. on successful match/es), we use this trick:
     - ensure the template will not propagate any denormalized whitespace
     - inject denormalized whitespace (superfluous space) artificially
       to mark successful production (but see B. below)
     - with the template production, here stored as Var variable,
       we test "normalize-space($Var) != $Var" condition to detect
       non-void production, mainly intended to see whether to emit
       the enclosing element at all (with the goal of not leaving
       superfluous elements behind needlessly)
  B. [extension over A.] to eliminate distorted indentation
     (cf. consideration 1.), additional reuse of these callable
     templates is introduced: the template can recursively call
     itself with a special flag (InnerSimulation) as an oracle to
     see to whether non-void production will ensue (all pre-existing
     denormalized whitespace is forcefully removed in this mode),
     and if positive, all such inner pre-existing whitespace is
     then preserved in this outer=main invocation
  C. [extension over B.] when checking the non-void production
     (via InnerSimulation), beside the injected denormalized whitespace,
     we can also inject particular strings, which the callsite of such
     simulation can, in addition, inspect for paricular string
     occurrences, e.g. to prevent clashes on the production coming
     from multiple sources
  D. not only to honour DRY principle and to avoid inner entropy, it's
     often useful to make callable template bimodal, e.g., when the
     production is generated in the "what's to stay in place" vs.
     "what's to be propagated (combined with previous, effectively
     moved) at this other part of the tree" contexts; for such cases,
     there's usually InverseMode parameter to be assigned true()
     (implicit default) and false(), respectively
  E. the common idiom that emerges is: evaluate simulation value,
     depending on the presence of the "success mark" (cf. A.),
     possibly emit non-simulation value; since it would (likely)
     re-evaluate the simulation anew (wastefully) or perhaps
     this sort of dependency injection can just come handy,
     common transformation helpers below offer InnerPass
     parameter to be optionally passed, either as a string (when
     no-denormalized-space is an internal criterium for the template)
     or, conventionally, the result tree fragment representing the
     output of the template at hand called with a simulation flag
 
  -->
 
 <!--
  Source ctxt:    cluster_property_set
  Target ctxt:    cluster_property_set
  Target-inv ctxt:/cib/configuration/(op_defaults|rsc_defaults)
                  [cluster_property_set -> meta_attributes]
  Dependencies:   N/A
  -->
 <xsl:template name="ProcessClusterProperties">
   <xsl:param name="Source"/>
   <xsl:param name="InverseMode" select="false()"/>
   <xsl:param name="InnerSimulation" select="false()"/>
   <xsl:param name="InnerPass">
     <xsl:choose>
       <xsl:when test="$InnerSimulation">
         <xsl:value-of select="''"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:call-template name="ProcessClusterProperties">
           <xsl:with-param name="Source" select="$Source"/>
           <xsl:with-param name="InverseMode" select="$InverseMode"/>
           <xsl:with-param name="InnerSimulation" select="true()"/>
           <xsl:with-param name="InnerPass" select="'INNER-RECURSION'"/>
         </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:param>
 
   <xsl:for-each select="$Source/node()">
     <xsl:choose>
       <xsl:when test="self::text()">
         <!-- cf. trick A. (consideration 1.) -->
         <xsl:choose>
           <xsl:when test="normalize-space($InnerPass)
                           != $InnerPass
                           and
                           (
                             not(following-sibling::nvpair)
                             or
                             generate-id(following-sibling::nvpair[1])
                             != generate-id(following-sibling::*[1])
                           )">
             <xsl:value-of select="."/>
           </xsl:when>
           <xsl:otherwise>
             <xsl:value-of select="normalize-space(.)"/>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
       <xsl:when test="self::nvpair">
         <xsl:variable name="Replacement"
                       select="$MapClusterProperties/cibtr:replace[
                                 @what = current()/@name
                                 and
                                 (
                                   (
                                     @in-case-of
                                     and
                                     contains(concat('|', @in-case-of, '|'),
                                              concat('|', current()/@value, '|'))
                                   )
                                   or
                                   (
                                     not(@in-case-of)
                                     and
                                     not(
                                       $MapClusterProperties/cibtr:replace[
                                         @what = current()/@name
                                         and
                                         @in-case-of
                                         and
                                         contains(concat('|', @in-case-of, '|'),
                                                  concat('|', current()/@value, '|'))
                                       ]
                                     )
                                   )
                                 )
                               ]"/>
         <xsl:if test="$InverseMode = false()
                       and
                       $InnerSimulation
                       and
                       $InnerPass = 'INNER-RECURSION'">
           <xsl:call-template name="MapMsg">
             <xsl:with-param name="Context" select="@id"/>
             <xsl:with-param name="Replacement" select="$Replacement"/>
           </xsl:call-template>
         </xsl:if>
         <xsl:choose>
           <xsl:when test="$Replacement
                           and
                           (
                             not(string($Replacement/@with))
                             or
                             $Replacement/@where
                           )">
             <!-- drop (possibly just move over) -->
             <xsl:if test="$Replacement/@where
                           and
                           (
                             (
                               normalize-space($InverseMode)
                               and
                               $Replacement/@where = $InverseMode
                             )
                             or
                             (
                               not(normalize-space($InverseMode))
                               and
                               (true() or count($InverseMode))
                               and
                               not(
                                 $InverseMode/nvpair[
                                   @name = $Replacement/@with
                                 ]
                               )
                               and
                               $Replacement/@where = name($InverseMode/..)
                             )
                           )">
               <xsl:call-template name="HelperDenormalizedSpace">
                 <xsl:with-param name="Source" select="."/>
                 <xsl:with-param name="InnerSimulation" select="$InnerSimulation"/>
               </xsl:call-template>
               <xsl:copy>
                 <xsl:for-each select="@*">
                   <xsl:choose>
                     <xsl:when test="name() = 'name'">
                       <xsl:attribute name="{name()}">
                         <xsl:value-of select="$Replacement/@with"/>
                       </xsl:attribute>
                     </xsl:when>
                     <xsl:when test="string($Replacement/@redefined-as)
                                     and
                                     name() = 'value'">
                       <xsl:attribute name="{name()}">
                         <xsl:value-of select="$Replacement/@redefined-as"/>
                       </xsl:attribute>
                     </xsl:when>
                     <xsl:otherwise>
                       <xsl:copy/>
                     </xsl:otherwise>
                   </xsl:choose>
                 </xsl:for-each>
               </xsl:copy>
             </xsl:if>
           </xsl:when>
           <xsl:when test="$InverseMode"/>
           <xsl:when test="$Replacement">
             <xsl:call-template name="HelperDenormalizedSpace">
               <xsl:with-param name="Source" select="."/>
               <xsl:with-param name="InnerSimulation" select="$InnerSimulation"/>
             </xsl:call-template>
             <xsl:copy>
               <xsl:for-each select="@*">
                 <xsl:choose>
                   <xsl:when test="name() = 'name'">
                     <xsl:attribute name="{name()}">
                       <xsl:value-of select="$Replacement/@with"/>
                     </xsl:attribute>
                   </xsl:when>
                   <xsl:when test="string($Replacement/@redefined-as)
                                   and
                                   name() = 'value'">
                     <xsl:attribute name="{name()}">
                       <xsl:value-of select="$Replacement/@redefined-as"/>
                     </xsl:attribute>
                   </xsl:when>
                   <xsl:otherwise>
                     <xsl:copy/>
                   </xsl:otherwise>
                 </xsl:choose>
               </xsl:for-each>
             </xsl:copy>
           </xsl:when>
           <xsl:otherwise>
             <xsl:call-template name="HelperDenormalizedSpace">
               <xsl:with-param name="Source" select="."/>
               <xsl:with-param name="InnerSimulation" select="$InnerSimulation"/>
             </xsl:call-template>
             <xsl:call-template name="HelperIdentity"/>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
       <xsl:when test="$InverseMode
                       or
                       self::comment()">
         <!-- drop -->
       </xsl:when>
       <xsl:otherwise>
         <xsl:call-template name="HelperIdentity"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:for-each>
 </xsl:template>
 
 <!--
  Source ctxt:    (primitive|template)/instance_attributes
  Target ctxt:    (primitive|template)/instance_attributes
  Target-inv ctxt:N/A
  Dependencies:   N/A
  -->
 <xsl:template name="ProcessRscInstanceAttributes">
   <xsl:param name="Source"/>
   <xsl:param name="InverseMode" select="false()"/>
   <xsl:param name="InnerSimulation" select="false()"/>
   <xsl:param name="InnerPass">
     <xsl:choose>
       <xsl:when test="$InverseMode
                       or
                       $InnerSimulation">
         <xsl:value-of select="''"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:call-template name="ProcessRscInstanceAttributes">
           <xsl:with-param name="Source" select="$Source"/>
           <xsl:with-param name="InnerSimulation" select="true()"/>
         </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:param>
 
   <!-- B: special-casing nvpair -->
   <xsl:for-each select="$Source/node()">
     <xsl:choose>
       <xsl:when test="self::text()
                       and
                       not($InverseMode)">
         <!-- cf. trick A. (consideration 1.) -->
         <xsl:choose>
           <xsl:when test="normalize-space($InnerPass)
                           != $InnerPass
                           and
                           (
                             not(following-sibling::nvpair)
                             or
                             generate-id(following-sibling::nvpair[1])
                             != generate-id(following-sibling::*[1])
                           )">
             <xsl:value-of select="."/>
           </xsl:when>
           <xsl:otherwise>
             <xsl:value-of select="normalize-space(.)"/>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
       <xsl:when test="self::nvpair">
         <xsl:variable name="Replacement"
                       select="$MapResourceInstanceAttributes/cibtr:replace[
                                 @what = current()/@name
                                 and
                                 (
                                   (
                                     @in-case-of
                                     and
                                     contains(concat('|', @in-case-of, '|'),
                                              concat('|', current()/@value, '|'))
                                   )
                                   or
                                   (
                                     @in-case-of-droppable-prefix
                                     and
                                     starts-with(current()/@value,
                                                 @in-case-of-droppable-prefix)
                                     and
                                     not(
                                       contains(current()/@value, ',')
                                     )
                                   )
                                   or
                                   (
                                     not(@in-case-of)
                                     and
                                     not(@in-case-of-droppable-prefix)
                                     and
                                     not(
                                       $MapResourceInstanceAttributes/cibtr:replace[
                                         @what = current()/@name
                                         and
                                         (
                                           (
                                             @in-case-of
                                             and
                                             contains(concat('|', @in-case-of, '|'),
                                                      concat('|', current()/@value, '|'))
                                           )
                                           or
                                           (
                                             @in-case-of-droppable-prefix
                                             and
                                             starts-with(current()/@value,
                                                         @in-case-of-droppable-prefix)
                                             and
                                             not(
                                               contains(current()/@value, ',')
                                             )
                                           )
                                         )
                                       ]
                                     )
                                   )
                                 )
                               ]"/>
         <xsl:if test="not($InverseMode or $InnerSimulation)">
           <xsl:call-template name="MapMsg">
             <xsl:with-param name="Context" select="@id"/>
             <xsl:with-param name="Replacement" select="$Replacement"/>
           </xsl:call-template>
         </xsl:if>
         <xsl:choose>
           <xsl:when test="$Replacement
                           and
                           (
                             not(string($Replacement/@with))
                             or
                             $Replacement/@where
                           )">
             <!-- drop (move-over code missing) -->
           </xsl:when>
           <xsl:when test="$InverseMode"/>
           <xsl:when test="$Replacement">
             <!-- plain rename (space helper?) -->
             <xsl:call-template name="HelperDenormalizedSpace">
               <xsl:with-param name="Source" select="."/>
               <xsl:with-param name="InnerSimulation" select="$InnerSimulation"/>
             </xsl:call-template>
             <xsl:copy>
               <xsl:for-each select="@*">
                 <xsl:choose>
                   <xsl:when test="name() = 'name'">
                     <xsl:attribute name="{name()}">
                       <xsl:value-of select="$Replacement/@with"/>
                     </xsl:attribute>
                   </xsl:when>
                   <xsl:when test="string($Replacement/@redefined-as)
                                   and
                                   name() = 'value'">
                     <xsl:attribute name="{name()}">
                       <xsl:value-of select="$Replacement/@redefined-as"/>
                     </xsl:attribute>
                   </xsl:when>
                   <xsl:when test="string($Replacement/@in-case-of-droppable-prefix)
                                   and
                                   name() = 'value'">
                     <xsl:attribute name="{name()}">
                       <xsl:value-of select="substring-after(
                                               ., $Replacement/@in-case-of-droppable-prefix
                                             )"/>
                     </xsl:attribute>
                   </xsl:when>
                   <xsl:otherwise>
                     <xsl:copy/>
                   </xsl:otherwise>
                 </xsl:choose>
               </xsl:for-each>
             </xsl:copy>
           </xsl:when>
           <xsl:otherwise>
             <xsl:call-template name="HelperDenormalizedSpace">
               <xsl:with-param name="Source" select="."/>
               <xsl:with-param name="InnerSimulation" select="$InnerSimulation"/>
             </xsl:call-template>
             <xsl:copy>
               <xsl:apply-templates select="@*|node()"/>
             </xsl:copy>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
       <xsl:when test="$InverseMode
                       or
                       self::comment()">
         <!-- drop -->
       </xsl:when>
       <xsl:otherwise>
         <xsl:copy>
           <xsl:apply-templates select="@*|node()"/>
         </xsl:copy>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:for-each>
   <!-- E: special-casing nvpair -->
 </xsl:template>
 
 <!--
  Source ctxt:    (primitive|template)/operations/op/meta_attributes
  Target ctxt:    (primitive|template)/operations/op/meta_attributes
  Target-inv ctxt:(primitive|template)/meta_attributes
  Dependencies:   ProcessAttrOpMetaAttributes
                  ProcessNonattrOpMetaAttributes
  -->
 <xsl:template name="ProcessNonattrOpMetaAttributes">
   <xsl:param name="Source"/>
   <xsl:param name="InverseMode" select="false()"/>
   <xsl:param name="InnerSimulation" select="false()"/>
   <xsl:param name="InnerPass">
     <xsl:choose>
       <xsl:when test="$InnerSimulation">
         <xsl:value-of select="''"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:call-template name="ProcessNonattrOpMetaAttributes">
           <xsl:with-param name="Source" select="$Source"/>
           <xsl:with-param name="InnerSimulation" select="true()"/>
           <xsl:with-param name="InnerPass" select="'INNER-RECURSION'"/>
         </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:param>
 
   <xsl:variable name="EnclosingTag" select="../../.."/>
 
   <xsl:for-each select="$Source/node()">
     <xsl:choose>
       <xsl:when test="self::text()
                       and
                       not($InverseMode)">
         <!-- cf. trick A. (consideration 1.) -->
         <xsl:choose>
           <xsl:when test="normalize-space($InnerPass)
                           != $InnerPass
                           and
                           (
                             not(following-sibling::nvpair)
                             or
                             generate-id(following-sibling::nvpair[1])
                             != generate-id(following-sibling::*[1])
                           )">
             <xsl:value-of select="."/>
           </xsl:when>
           <xsl:otherwise>
             <xsl:value-of select="normalize-space(.)"/>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
       <xsl:when test="self::nvpair">
         <xsl:variable name="Replacement"
                       select="$MapResourcesOperation/cibtr:replace[
                                 @what = current()/@name
                                 and
                                 (
                                   (
                                     @in-case-of
                                     and
                                     contains(concat('|', @in-case-of, '|'),
                                              concat('|', current()/../../@name, '|'))
                                   )
                                   or
                                   (
                                     not(@in-case-of)
                                     and
                                     not(
                                       $MapResourcesOperation/cibtr:replace[
                                         @what = current()/@name
                                         and
                                         @in-case-of
                                         and
                                         contains(concat('|', @in-case-of, '|'),
                                                  concat('|', current()/../../@name, '|'))
                                       ]
                                     )
                                   )
                                 )
                               ]"/>
         <xsl:if test="not($InnerSimulation)">
           <xsl:call-template name="MapMsg">
             <xsl:with-param name="Context" select="../../@id"/>
             <xsl:with-param name="Replacement" select="$Replacement"/>
           </xsl:call-template>
         </xsl:if>
         <xsl:choose>
           <xsl:when test="$Replacement
                           and
                           (
                             not(string($Replacement/@with))
                             or
                             $Replacement/@where
                           )">
             <!-- drop (possibly just move over) -->
             <xsl:variable name="SimulateAttrOverrides">
               <xsl:for-each select="../../../op">
                 <xsl:call-template name="ProcessAttrOpMetaAttributes">
                   <xsl:with-param name="Source" select="."/>
                   <xsl:with-param name="InverseMode" select="true()"/>
                   <xsl:with-param name="InnerSimulation" select="true()"/>
                 </xsl:call-template>
               </xsl:for-each>
             </xsl:variable>
             <xsl:if test="$InverseMode
                           and
                           not(
                             contains($SimulateAttrOverrides,
                                      concat(@name, ' '))
                           )">
               <!-- do not override; do not collide with:
                    - newly added from op/@* (see last condition above)
                    - existing - actually subsumed with the previous point
                    - successors sourced like this (see below) -->
               <xsl:variable name="SimulateFollowingSiblings">
                 <!-- cf. similar handling in ProcessAttrOpMetaAttributes,
                      but this is more convoluted -->
                 <xsl:for-each select="(../following-sibling::meta_attributes
                                        |../../following-sibling::op/meta_attributes)[
                                         not(rule)
                                       ]">
                   <xsl:call-template name="ProcessNonattrOpMetaAttributes">
                     <xsl:with-param name="Source" select="."/>
                     <xsl:with-param name="InverseMode" select="true()"/>
                     <xsl:with-param name="InnerSimulation" select="true()"/>
                   </xsl:call-template>
                 </xsl:for-each>
               </xsl:variable>
               <xsl:if test="$Replacement/@where = 'meta_attributes'
                             and
                             not(
                               $EnclosingTag/meta_attributes[
                                 not(rule)
                                 and
                                 nvpair/@name = $Replacement/@with
                               ]
                             )
                             and
                             not(
                               contains($SimulateFollowingSiblings,
                                        concat(@name, ' '))
                             )">
                 <!-- cf. trick C. (indicate for inverse mode) -->
                 <xsl:choose>
                   <xsl:when test="$InnerSimulation">
                     <xsl:value-of select="concat(@name, ' ')"/>
                   </xsl:when>
                   <xsl:otherwise>
                     <xsl:text> </xsl:text>
                     <xsl:copy>
                       <xsl:apply-templates select="@*"/>
                     </xsl:copy>
                   </xsl:otherwise>
                 </xsl:choose>
               </xsl:if>
             </xsl:if>
           </xsl:when>
           <xsl:when test="$Replacement">
             <xsl:message terminate="yes">
               <xsl:value-of select="concat('INTERNAL ERROR: ',
                                            $Replacement/../@msg-prefix,
                                            ': no in-situ rename',
                                            ' does not hold (',
                                            not(($InverseMode)), ')')"/>
             </xsl:message>
           </xsl:when>
           <xsl:when test="$InverseMode"/>
           <xsl:otherwise>
             <xsl:call-template name="HelperDenormalizedSpace">
               <xsl:with-param name="Source" select="."/>
               <xsl:with-param name="InnerSimulation" select="$InnerSimulation"/>
             </xsl:call-template>
             <xsl:call-template name="HelperIdentity"/>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
       <xsl:when test="$InverseMode
                       or
                       self::comment()">
         <!-- drop -->
       </xsl:when>
       <xsl:otherwise>
         <xsl:call-template name="HelperIdentity"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:for-each>
 </xsl:template>
 
 <!--
  Source ctxt:    (primitive|template)/operations/op
  Target ctxt:    (primitive|template)/operations/op/meta_attributes
  Target-inv ctxt:(primitive|template)/meta_attributes
  Dependencies:   ProcessNonattrOpMetaAttributes [non-inverse only]
  -->
 <xsl:template name="ProcessAttrOpMetaAttributes">
   <xsl:param name="Source"/>
   <xsl:param name="InverseMode" select="false()"/>
   <xsl:param name="InnerSimulation" select="false()"/>
   <xsl:param name="InnerPass">
     <xsl:choose>
       <xsl:when test="$InnerSimulation">
         <xsl:value-of select="''"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:call-template name="ProcessAttrOpMetaAttributes">
           <xsl:with-param name="Source" select="$Source"/>
           <xsl:with-param name="InverseMode" select="$InverseMode"/>
           <xsl:with-param name="InnerSimulation" select="true()"/>
         </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:param>
 
   <xsl:variable name="EnclosingTag" select="../.."/>
 
   <xsl:if test="(
                   $InverseMode
                   and
                   (
                     $InnerSimulation
                     or
                     normalize-space($InnerPass)
                     != string($InnerPass)
                   )
                 )
                 or
                 not($InverseMode)">
     <xsl:if test="$InverseMode
                   and
                   $InnerSimulation">
       <xsl:call-template name="HelperDenormalizedSpace">
         <xsl:with-param name="Source" select="$InnerPass"/>
         <xsl:with-param name="ResultTreeFragment" select="true()"/>
       </xsl:call-template>
     </xsl:if>
 
     <!-- cannot combine "copy" with creating a new element, hence we mimic
          "copy" with recreating the element anew, while still using just
          a single for-each loop -->
     <xsl:variable name="ParentName">
       <xsl:choose>
         <xsl:when test="not($InverseMode)">
           <xsl:value-of select="name()"/>
         </xsl:when>
         <xsl:otherwise>
           <xsl:value-of select="'nvpair'"/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
     <xsl:element name="{$ParentName}">
     <!-- B: special-casing @* -->
     <xsl:for-each select="@*">
       <xsl:variable name="Replacement"
                     select="$MapResourcesOperation/cibtr:replace[
                               @what = name(current())
                               and
                               (
                                 (
                                   @in-case-of
                                   and
                                   contains(concat('|', @in-case-of, '|'),
                                            concat('|', current()/../@name, '|'))
                                 )
                                 or
                                 (
                                   not(@in-case-of)
                                   and
                                   not(
                                     $MapResourcesOperation/cibtr:replace[
                                       @what = name(current())
                                       and
                                       @in-case-of
                                       and
                                       contains(concat('|', @in-case-of, '|'),
                                                concat('|', current()/../@name, '|'))
                                     ]
                                   )
                                 )
                               )
                             ]"/>
       <xsl:if test="not($InverseMode or $InnerSimulation)">
         <xsl:call-template name="MapMsg">
           <xsl:with-param name="Context" select="../../@id"/>
           <xsl:with-param name="Replacement" select="$Replacement"/>
         </xsl:call-template>
       </xsl:if>
       <xsl:choose>
         <!-- use inner simulation to find out if success,
              then emit also extra denormalized space -->
         <xsl:when test="$InverseMode
                         and
                         $Replacement/@where = 'meta_attributes'
                         and
                         not(
                           $EnclosingTag/meta_attributes[
                             not(rule)
                             and
                             nvpair/@name = $Replacement/@with
                           ]
                         )">
           <!-- do not override; do not collide with:
                - existing (see last condition above)
                - successors sourced like this (see below) -->
           <xsl:variable name="SimulateFollowingSiblings">
             <xsl:for-each select="../following-sibling::op">
               <xsl:call-template name="ProcessAttrOpMetaAttributes">
                 <xsl:with-param name="Source" select="."/>
                 <xsl:with-param name="InverseMode" select="true()"/>
                 <xsl:with-param name="InnerSimulation" select="true()"/>
               </xsl:call-template>
             </xsl:for-each>
           </xsl:variable>
           <xsl:if test="not(contains($SimulateFollowingSiblings,
                                      concat(name(), ' ')))">
             <!-- fix concurrent op/@* sources (these themselves are winning
                  over sources from meta_attributes -->
             <xsl:choose>
               <xsl:when test="$InnerSimulation">
                 <!-- cf. trick C. (indicate for inverse mode) -->
                 <xsl:value-of select="concat(name(), ' ')"/>
               </xsl:when>
               <xsl:otherwise>
                 <xsl:attribute name="id">
                   <xsl:value-of select="concat('_2TO3_', ../@id, '-meta-',
                                                $Replacement/@with)"/>
                 </xsl:attribute>
                 <xsl:attribute name="name">
                   <xsl:value-of select="$Replacement/@with"/>
                 </xsl:attribute>
                 <xsl:attribute name="value">
                   <xsl:value-of select="."/>
                 </xsl:attribute>
               </xsl:otherwise>
             </xsl:choose>
           </xsl:if>
         </xsl:when>
         <xsl:when test="$InverseMode"/>
         <xsl:when test="$Replacement
                         and
                         (
                           not(string($Replacement/@with))
                           or
                           $Replacement/@where
                         )">
           <!-- drop (possibly just move over) -->
         </xsl:when>
         <xsl:when test="$Replacement">
           <xsl:message terminate="yes">
             <xsl:value-of select="concat('INTERNAL ERROR: ',
                                          $Replacement/../@msg-prefix,
                                          ': no in-situ rename',
                                          ' does not hold')"/>
           </xsl:message>
         </xsl:when>
         <xsl:otherwise>
           <!--xsl:attribute name="{name()}">
             <xsl:value-of select="."/>
           </xsl:attribute-->
           <xsl:copy/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:for-each>
 
     <xsl:if test="not($InverseMode)">
       <!-- B: special-casing meta_attributes -->
       <xsl:for-each select="$Source/node()">
         <xsl:choose>
           <xsl:when test="self::text()
                           and
                           not($InverseMode)">
             <!-- cf. trick A. (consideration 1.) -->
             <xsl:choose>
               <xsl:when test="normalize-space($InnerPass)
                               != $InnerPass
                               and
                               (
                                 not(following-sibling::nvpair)
                                 or
                                 generate-id(following-sibling::nvpair[1])
                                 != generate-id(following-sibling::*[1])
                               )">
                 <xsl:value-of select="."/>
               </xsl:when>
               <xsl:otherwise>
                 <xsl:value-of select="normalize-space(.)"/>
               </xsl:otherwise>
             </xsl:choose>
           </xsl:when>
           <xsl:when test="self::meta_attributes">
             <xsl:variable name="ProcessedOpMetaAttributes">
               <xsl:call-template name="ProcessNonattrOpMetaAttributes">
                 <xsl:with-param name="Source" select="."/>
                 <xsl:with-param name="InnerSimulation" select="true()"/>
               </xsl:call-template>
             </xsl:variable>
             <!-- cf. trick A. -->
             <xsl:if test="normalize-space($ProcessedOpMetaAttributes)
                           != $ProcessedOpMetaAttributes">
               <xsl:copy>
                 <xsl:apply-templates select="@*"/>
                 <xsl:call-template name="ProcessNonattrOpMetaAttributes">
                   <xsl:with-param name="Source" select="."/>
                   <xsl:with-param name="InnerSimulation" select="$InnerSimulation"/>
                   <!-- cf. trick E. -->
                   <xsl:with-param name="InnerPass" select="$ProcessedOpMetaAttributes"/>
                 </xsl:call-template>
               </xsl:copy>
             </xsl:if>
           </xsl:when>
           <xsl:otherwise>
             <xsl:call-template name="HelperIdentity"/>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:for-each>
     </xsl:if>
     <!-- E: special-casing meta_attributes -->
     </xsl:element>
   </xsl:if>
 </xsl:template>
 
 <!--
  Source ctxt:    configuration
  Target ctxt:    {op,rsc}_defaults/meta_attributes [per $Variant, see below]
  Target-inv ctxt:N/A
  Dependencies:   ProcessClusterProperties
 
  Variant:        'op_defaults' | 'rsc_defaults'
  -->
 <xsl:template name="ProcessDefaultsNonruleClusterProperties">
   <xsl:param name="Source"/>
   <xsl:param name="Variant"/>
   <xsl:param name="InnerSimulation" select="false()"/>
   <xsl:param name="InnerPass">
     <xsl:choose>
       <xsl:when test="$InnerSimulation">
         <xsl:value-of select="''"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:call-template name="ProcessDefaultsNonruleClusterProperties">
           <xsl:with-param name="Source" select="$Source"/>
           <xsl:with-param name="Variant" select="$Variant"/>
           <xsl:with-param name="InnerSimulation" select="true()"/>
           <xsl:with-param name="InnerPass" select="'INNER-RECURSION'"/>
         </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:param>
 
   <xsl:choose>
     <xsl:when test="$Source/*[name() = $Variant]/meta_attributes[
                       not(@id-ref)
                       and
                       not(rule)
                     ]">
       <xsl:call-template name="ProcessClusterProperties">
         <xsl:with-param name="Source"
                         select="$Source/crm_config/cluster_property_set[
                                   not(@id-ref)
                                   and
                                   not(rule)
                                 ]"/>
         <xsl:with-param name="InverseMode"
                         select="$Source/*[name() = $Variant]/meta_attributes[
                                   not(@id-ref)
                                   and
                                   not(rule)
                                 ]"/>
         <xsl:with-param name="InnerSimulation" select="$InnerSimulation"/>
       </xsl:call-template>
     </xsl:when>
     <xsl:otherwise>
       <xsl:call-template name="ProcessClusterProperties">
         <xsl:with-param name="Source"
                       select="$Source/crm_config/cluster_property_set[
                                   not(@id-ref)
                                   and
                                   not(rule)
                                 ]"/>
         <xsl:with-param name="InverseMode"
                         select="$Variant"/>
         <xsl:with-param name="InnerSimulation" select="$InnerSimulation"/>
       </xsl:call-template>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
 
 <!--
  Source ctxt:    configuration
  Target ctxt:    {op,rsc}_defaults/meta_attributes [per $Variant, see below]
  Target-inv ctxt:N/A
  Dependencies:   ProcessClusterProperties
 
  Variant:        'op_defaults' | 'rsc_defaults'
  -->
 <xsl:template name="ProcessDefaultsRuleClusterProperties">
   <xsl:param name="Source"/>
   <xsl:param name="Variant"/>
   <xsl:param name="InnerSimulation" select="false()"/>
   <xsl:param name="InnerPass">
     <xsl:choose>
       <xsl:when test="$InnerSimulation">
         <xsl:value-of select="''"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:call-template name="ProcessDefaultsRuleClusterProperties">
           <xsl:with-param name="Source" select="$Source"/>
           <xsl:with-param name="Variant" select="$Variant"/>
           <xsl:with-param name="InnerSimulation" select="true()"/>
           <xsl:with-param name="InnerPass" select="'INNER-RECURSION'"/>
         </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:param>
 
   <xsl:for-each select="crm_config/cluster_property_set[
                           not(@id-ref)
                           and
                           rule
                         ]">
     <xsl:variable name="ProcessedPartial">
       <xsl:call-template name="ProcessClusterProperties">
         <xsl:with-param name="Source" select="$Source"/>
         <xsl:with-param name="InverseMode" select="$Variant"/>
         <xsl:with-param name="InnerSimulation" select="true()"/>
       </xsl:call-template>
     </xsl:variable>
     <xsl:if test="normalize-space($ProcessedPartial)
                   != $ProcessedPartial">
       <meta_attributes id="{concat('_2TO3_', @id)}">
         <xsl-copy-of select="rule"/>
         <xsl:call-template name="ProcessClusterProperties">
           <xsl:with-param name="Source" select="$Source"/>
           <xsl:with-param name="InverseMode" select="$Variant"/>
         </xsl:call-template>
       </meta_attributes>
     </xsl:if>
   </xsl:for-each>
 </xsl:template>
 
 <!--
 
  ACTUAL TRANSFORMATION
 
  -->
 
 <xsl:template match="cib">
   <xsl:copy>
     <xsl:apply-templates select="@*"/>
     <xsl:attribute name="validate-with">
       <xsl:value-of select="concat('pacemaker-', $cib-min-ver)"/>
     </xsl:attribute>
     <xsl:apply-templates select="node()"/>
   </xsl:copy>
 </xsl:template>
 
 <xsl:template match="cluster_property_set">
   <xsl:variable name="ProcessedClusterProperties">
     <xsl:call-template name="ProcessClusterProperties">
       <xsl:with-param name="Source" select="."/>
       <xsl:with-param name="InnerSimulation" select="true()"/>
       <xsl:with-param name="InnerPass" select="'INNER-RECURSION'"/>
     </xsl:call-template>
   </xsl:variable>
   <xsl:if test="normalize-space($ProcessedClusterProperties)
                 != $ProcessedClusterProperties">
     <xsl:copy>
       <xsl:apply-templates select="@*"/>
       <xsl:call-template name="ProcessClusterProperties">
         <xsl:with-param name="Source" select="."/>
         <!-- cf. trick E. -->
         <xsl:with-param name="InnerPass" select="$ProcessedClusterProperties"/>
       </xsl:call-template>
     </xsl:copy>
   </xsl:if>
 </xsl:template>
 
 <xsl:template match="rsc_colocation">
   <xsl:copy>
     <xsl:for-each select="@*">
       <xsl:variable name="Replacement"
                     select="$MapConstraintsColocation/cibtr:replace[
                               @what = name(current())
                             ]"/>
       <xsl:call-template name="MapMsg">
         <xsl:with-param name="Context" select="../@id"/>
         <xsl:with-param name="Replacement" select="$Replacement"/>
       </xsl:call-template>
       <xsl:choose>
         <xsl:when test="$Replacement
                         and
                         not(string($Replacement/@with))">
           <!-- drop -->
         </xsl:when>
         <xsl:when test="$Replacement">
           <!-- rename -->
           <xsl:attribute name="{name()}">
             <xsl:value-of select="$Replacement/@with"/>
           </xsl:attribute>
         </xsl:when>
         <xsl:otherwise>
           <xsl:copy/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:for-each>
     <xsl:apply-templates select="node()"/>
   </xsl:copy>
 </xsl:template>
 
 <xsl:template match="node">
   <xsl:copy>
     <xsl:for-each select="@*">
       <xsl:variable name="Replacement"
                     select="$MapClusterNode/cibtr:replace[
                               @what = name(current())
                               and
                               (
                                 (
                                   @in-case-of
                                   and
                                   contains(concat('|', @in-case-of, '|'),
                                            concat('|', current(), '|'))
                                 )
                                 or
                                 (
                                   not(@in-case-of)
                                   and
                                   not(
                                     $MapClusterNode/cibtr:replace[
-                                      @what = current()/@name
+                                      @what = name(current())
                                       and
                                       @in-case-of
                                       and
                                       contains(concat('|', @in-case-of, '|'),
                                                concat('|', current(), '|'))
                                     ]
                                   )
                                 )
                               )
                             ]"/>
       <xsl:call-template name="MapMsg">
         <xsl:with-param name="Context" select="concat(../@uname, ' (id=', ../@id, ')')"/>
         <xsl:with-param name="Replacement" select="$Replacement"/>
       </xsl:call-template>
       <xsl:choose>
         <xsl:when test="$Replacement
                         and
                         not(string($Replacement/@with))">
           <!-- drop -->
         </xsl:when>
         <xsl:when test="$Replacement">
           <!-- rename -->
           <xsl:attribute name="{$Replacement/@with}">
             <xsl:choose>
               <xsl:when test="$Replacement/@redefined-as">
                 <xsl:value-of select="$Replacement/@redefined-as"/>
               </xsl:when>
               <xsl:otherwise>
                 <xsl:value-of select="."/>
               </xsl:otherwise>
             </xsl:choose>
           </xsl:attribute>
         </xsl:when>
         <xsl:otherwise>
           <xsl:copy/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:for-each>
     <xsl:apply-templates select="node()"/>
   </xsl:copy>
 </xsl:template>
 
 <!--
  1a. propagate (primitive|template)/operations/
        op[name() = 'start' or name() = 'promote']/@requires
      under new ./meta_attributes/nvpair
 
  1b. "move" (primitive|template)/operations/
        op[name() = 'start' or name() = 'promote']/
        meta_attributes/nvpair[@requires]
      under ./meta_attributes
 
   otherwise, just
 
  2a.  drop (primitive|template)/operations/
         op/@requires
 
  2b.  drop (primitive|template)/operations/
         op/meta_attributes/nvpair[@requires]
 
  Not compatible with meta_attributes referenced via id-ref
  (would need external preprocessing).
  -->
 <xsl:template match="primitive|template">
   <xsl:copy>
     <xsl:apply-templates select="@*"/>
     <!-- B: special-casing operations|instance_attributes -->
     <xsl:for-each select="node()">
       <xsl:choose>
         <xsl:when test="self::operations">
           <xsl:copy>
             <xsl:apply-templates select="@*"/>
             <!-- B: special-casing op -->
             <xsl:for-each select="node()">
               <xsl:choose>
                 <xsl:when test="self::op">
                   <!-- process @*|meta_attributes/nvpair
                        (keep/drop/move elsewhere) -->
                   <xsl:call-template name="ProcessAttrOpMetaAttributes">
                     <xsl:with-param name="Source" select="."/>
                   </xsl:call-template>
                 </xsl:when>
                 <xsl:otherwise>
                   <xsl:call-template name="HelperIdentity"/>
                 </xsl:otherwise>
               </xsl:choose>
             </xsl:for-each>
             <!-- E: special-casing op -->
           </xsl:copy>
         </xsl:when>
         <xsl:when test="self::instance_attributes">
           <xsl:variable name="ProcessedRscInstanceAttributes">
             <xsl:call-template name="ProcessRscInstanceAttributes">
               <xsl:with-param name="Source" select="."/>
               <xsl:with-param name="InnerSimulation" select="true()"/>
             </xsl:call-template>
           </xsl:variable>
           <!-- cf. trick A. -->
           <xsl:if test="normalize-space($ProcessedRscInstanceAttributes)
                         != $ProcessedRscInstanceAttributes">
             <xsl:copy>
               <xsl:apply-templates select="@*"/>
               <xsl:call-template name="ProcessRscInstanceAttributes">
                 <xsl:with-param name="Source" select="."/>
                 <!-- cf. trick E. -->
                 <xsl:with-param name="InnerPass" select="$ProcessedRscInstanceAttributes"/>
               </xsl:call-template>
             </xsl:copy>
           </xsl:if>
         </xsl:when>
         <xsl:otherwise>
           <xsl:call-template name="HelperIdentity"/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:for-each>
     <!-- E: special-casing operations -->
 
     <!-- add as last meta_attributes block... -->
 
     <!-- ...indirectly from op attributes -->
     <xsl:variable name="ToPropagateFromOp">
       <xsl:for-each select="operations/op">
         <xsl:call-template name="ProcessAttrOpMetaAttributes">
           <xsl:with-param name="Source" select="."/>
           <xsl:with-param name="InverseMode" select="true()"/>
           <xsl:with-param name="InnerSimulation" select="true()"/>
         </xsl:call-template>
       </xsl:for-each>
     </xsl:variable>
     <!-- cf. trick A. -->
     <xsl:if test="normalize-space($ToPropagateFromOp)
                   != $ToPropagateFromOp">
       <meta_attributes id="{concat('_2TO3_', @id, '-meta')}">
         <xsl:for-each select="operations/op">
           <xsl:call-template name="ProcessAttrOpMetaAttributes">
             <xsl:with-param name="Source" select="."/>
             <xsl:with-param name="InverseMode" select="true()"/>
           </xsl:call-template>
         </xsl:for-each>
       </meta_attributes>
     </xsl:if>
 
     <!-- ...directly by picking existing nvpairs of meta_attributes -->
     <xsl:for-each select="operations/op/meta_attributes">
       <xsl:variable name="ProcessedOpMetaAttributes">
         <xsl:call-template name="ProcessNonattrOpMetaAttributes">
           <xsl:with-param name="Source" select="."/>
           <xsl:with-param name="InverseMode" select="true()"/>
         </xsl:call-template>
       </xsl:variable>
       <!-- cf. trick A. -->
       <xsl:if test="normalize-space($ProcessedOpMetaAttributes)
                     != $ProcessedOpMetaAttributes">
         <xsl:copy>
           <xsl:apply-templates select="@*[
                                          name() != 'id'
                                        ]"/>
           <xsl:attribute name='id'>
             <xsl:value-of select="concat('_2TO3_', @id)"/>
           </xsl:attribute>
           <xsl:apply-templates select="node()[
                                          name() != 'nvpair'
                                        ]"/>
           <xsl:copy-of select="$ProcessedOpMetaAttributes"/>
           <xsl:apply-templates select="text()[position() = last()]"/>
         </xsl:copy>
       </xsl:if>
     </xsl:for-each>
   </xsl:copy>
 </xsl:template>
 
 <xsl:template match="configuration">
   <xsl:variable name="Configuration" select="."/>
   <xsl:variable name="ProcessedOpDefaultsNonruleClusterProperties">
     <xsl:call-template name="ProcessDefaultsNonruleClusterProperties">
       <xsl:with-param name="Source" select="$Configuration"/>
       <xsl:with-param name="Variant" select="'op_defaults'"/>
       <xsl:with-param name="InnerSimulation" select="true()"/>
     </xsl:call-template>
   </xsl:variable>
   <xsl:variable name="ProcessedRscDefaultsNonruleClusterProperties">
     <xsl:call-template name="ProcessDefaultsNonruleClusterProperties">
       <xsl:with-param name="Source" select="$Configuration"/>
       <xsl:with-param name="Variant" select="'rsc_defaults'"/>
       <xsl:with-param name="InnerSimulation" select="true()"/>
     </xsl:call-template>
   </xsl:variable>
   <xsl:variable name="ProcessedOpDefaultsRuleClusterProperties">
     <xsl:call-template name="ProcessDefaultsNonruleClusterProperties">
       <xsl:with-param name="Source" select="$Configuration"/>
       <xsl:with-param name="Variant" select="'op_defaults'"/>
       <xsl:with-param name="InnerSimulation" select="true()"/>
     </xsl:call-template>
   </xsl:variable>
   <xsl:variable name="ProcessedRscDefaultsRuleClusterProperties">
     <xsl:call-template name="ProcessDefaultsNonruleClusterProperties">
       <xsl:with-param name="Source" select="$Configuration"/>
       <xsl:with-param name="Variant" select="'rsc_defaults'"/>
       <xsl:with-param name="InnerSimulation" select="true()"/>
     </xsl:call-template>
   </xsl:variable>
 
   <xsl:copy>
     <xsl:apply-templates select="@*"/>
     <!-- B: special-casing {op,rsc}_defaults -->
     <xsl:for-each select="node()">
       <xsl:choose>
         <xsl:when test="self::op_defaults|self::rsc_defaults">
           <xsl:variable name="WhichDefaults" select="name()"/>
           <xsl:copy>
             <xsl:apply-templates select="@*"/>
             <!-- B: special-casing meta_attributes -->
             <xsl:for-each select="node()">
               <xsl:copy>
                 <xsl:choose>
                   <xsl:when test="self::meta_attributes[
                                     not(@id-ref)
                                     and
                                     not(rule)
                                     and
                                     not(
                                       preceding-sibling::meta_attributes[
                                         not(@id-ref)
                                         and
                                         not(rule)
                                       ]
                                     )
                                   ]">
                     <xsl:apply-templates select="@*|node()"/>
                     <xsl:if test="$WhichDefaults = 'op_defaults'
                                   or
                                   $WhichDefaults = 'rsc_defaults'">
                       <xsl:call-template name="ProcessDefaultsNonruleClusterProperties">
                         <xsl:with-param name="Source" select="$Configuration"/>
                         <xsl:with-param name="Variant" select="$WhichDefaults"/>
                       </xsl:call-template>
                     </xsl:if>
                   </xsl:when>
                   <xsl:otherwise>
                     <xsl:apply-templates select="@*|node()"/>
                   </xsl:otherwise>
                 </xsl:choose>
                 <xsl:if test="(
                                 $WhichDefaults = 'op_defaults'
                                 and
                                 normalize-space($ProcessedOpDefaultsRuleClusterProperties)
                                 != $ProcessedOpDefaultsRuleClusterProperties
                               )
                               or
                               (
                                 $WhichDefaults = 'rsc_defaults'
                                 and
                                 normalize-space($ProcessedRscDefaultsRuleClusterProperties)
                                 != $ProcessedRscDefaultsRuleClusterProperties
                               )">
                   <xsl:call-template name="ProcessDefaultsRuleClusterProperties">
                     <xsl:with-param name="Source" select="$Configuration"/>
                     <xsl:with-param name="Variant" select="$WhichDefaults"/>
                   </xsl:call-template>
                 </xsl:if>
               </xsl:copy>
             </xsl:for-each>
             <!-- E: special-casing meta_attributes -->
           </xsl:copy>
         </xsl:when>
         <xsl:otherwise>
           <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
           </xsl:copy>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:for-each>
     <!-- E: special-casing {op,rsc}_defaults -->
     <xsl:if test="not(op_defaults)
                   and
                   (
                     normalize-space($ProcessedOpDefaultsNonruleClusterProperties)
                     != $ProcessedOpDefaultsNonruleClusterProperties
                     or
                     normalize-space($ProcessedOpDefaultsRuleClusterProperties)
                     != $ProcessedOpDefaultsRuleClusterProperties
                   )">
       <op_defaults>
         <xsl:if test="normalize-space($ProcessedOpDefaultsNonruleClusterProperties)
                       != $ProcessedOpDefaultsNonruleClusterProperties">
           <meta_attributes id="{concat('_2TO3_', '-op-defaults')}">
             <xsl:call-template name="ProcessDefaultsNonruleClusterProperties">
               <xsl:with-param name="Source" select="$Configuration"/>
               <xsl:with-param name="Variant" select="'op_defaults'"/>
             </xsl:call-template>
           </meta_attributes>
         </xsl:if>
         <xsl:call-template name="ProcessDefaultsRuleClusterProperties">
           <xsl:with-param name="Source" select="$Configuration"/>
           <xsl:with-param name="Variant" select="'op_defaults'"/>
         </xsl:call-template>
         <xsl:apply-templates select="text()[position() = last()]"/>
       </op_defaults>
     </xsl:if>
     <xsl:if test="not(rsc_defaults)
                   and
                   (
                     normalize-space($ProcessedRscDefaultsNonruleClusterProperties)
                     != $ProcessedRscDefaultsNonruleClusterProperties
                     or
                     normalize-space($ProcessedRscDefaultsRuleClusterProperties)
                     != $ProcessedRscDefaultsRuleClusterProperties
                   )">
       <rsc_defaults>
         <xsl:if test="normalize-space($ProcessedRscDefaultsNonruleClusterProperties)
                       != $ProcessedRscDefaultsNonruleClusterProperties">
           <meta_attributes id="{concat('_2TO3_', '-rsc-defaults')}">
             <xsl:call-template name="ProcessDefaultsNonruleClusterProperties">
               <xsl:with-param name="Source" select="$Configuration"/>
               <xsl:with-param name="Variant" select="'rsc_defaults'"/>
             </xsl:call-template>
           </meta_attributes>
         </xsl:if>
         <xsl:call-template name="ProcessDefaultsRuleClusterProperties">
           <xsl:with-param name="Source" select="$Configuration"/>
           <xsl:with-param name="Variant" select="'rsc_defaults'"/>
         </xsl:call-template>
         <xsl:apply-templates select="text()[position() = last()]"/>
       </rsc_defaults>
     </xsl:if>
   </xsl:copy>
 </xsl:template>
 
 <xsl:template match="@*|node()">
   <xsl:call-template name="HelperIdentity"/>
 </xsl:template>
 
 </xsl:stylesheet>