function insertFragment(sFragmentName, oElement, oWithControl) {
				var oFragmentPromise,
					fnLoad = oViewInfo.sync
						? XMLTemplateProcessor.loadTemplate
						: XMLTemplateProcessor.loadTemplatePromise,
					sPreviousName = sCurrentName;

				// Note: It is perfectly valid to include the very same fragment again, as long as
				// the context is changed. So we check for cycles at the current "with" control.
				// A context change will create a new one.
				oWithControl.$mFragmentContexts ??= {};
				if (oWithControl.$mFragmentContexts[sFragmentName]) {
					error("Cyclic reference to fragment '" + sFragmentName + "' ", oElement);
				}

				iNestingLevel++;
				debug(oElement, "fragmentName =", sFragmentName);
				oWithControl.$mFragmentContexts[sFragmentName] = true;
				sCurrentName = sFragmentName;

				Measurement.average(sPerformanceInsertFragment, "", aPerformanceCategories);
				// take fragment promise from cache, then import fragment
				oFragmentPromise = mFragmentCache[sFragmentName];
				if (!oFragmentPromise) {
					mFragmentCache[sFragmentName] = oFragmentPromise
						= SyncPromise.resolve(fnLoad(sFragmentName, "fragment"));
				}
				return oFragmentPromise.then(function (oFragmentElement) {
					oFragmentElement = oElement.ownerDocument.importNode(oFragmentElement, true);
					Measurement.end(sPerformanceInsertFragment);

					return requireFor(oFragmentElement).then(function () {
						if (oFragmentElement.namespaceURI === "sap.ui.core"
							&& oFragmentElement.localName === "FragmentDefinition") {
							return liftChildNodes(oFragmentElement, oWithControl, oElement);
						}
						oElement.parentNode.insertBefore(oFragmentElement, oElement);
						return visitNode(oFragmentElement, oWithControl);
					});
				}).then(function () {
					oElement.parentNode.removeChild(oElement);
					sCurrentName = sPreviousName;
					oWithControl.$mFragmentContexts[sFragmentName] = false;
					debugFinished(oElement);
					iNestingLevel -= 1;
				});
			}
Inserts the fragment with the given name in place of the given element. Loads the
fragment, takes care of caching (for the current pre-processor run) and visits the
fragment's content once it has been imported into the element's owner document and
put into place. Loading of fragments is asynchronous if the template view is
asynchronous.

@param {string} sFragmentName
  the fragment's resolved name
@param {Element} oElement
  the XML DOM element, e.g. <sap.ui.core:Fragment> or <core:ExtensionPoint>
@param {sap.ui.core.util._with} oWithControl
  the parent's "with" control
@returns {sap.ui.base.SyncPromise}
  A sync promise which resolves with <code>undefined</code> as soon as the fragment
  has been inserted, or is rejected with a corresponding error if loading or visiting
  fails.
@throws {Error}
  If a cycle is detected (same <code>sFragmentName</code> and
  <code>oWithControl</code>)