function templateWith(oElement, oWithControl) {
				var oBindingInfo,
					oModel,
					oNewWithControl,
					fnHelper,
					sHelper = oElement.getAttribute("helper"),
					vHelperResult,
					sPath = oElement.getAttribute("path"),
					oPromise,
					sResolvedPath,
					sVar = oElement.getAttribute("var");

				if (sVar === "") {
					error("Missing variable name for ", oElement);
				}
				oNewWithControl = new With();
				oWithControl.setChild(oNewWithControl);

				oBindingInfo = BindingParser.simpleParser("{" + sPath + "}");
				sVar = sVar || oBindingInfo.model; // default variable is same model name

				if (sHelper || sVar) { // create a "named context"
					oModel = oWithControl.getModel(oBindingInfo.model);
					if (!oModel) {
						error("Missing model '" + oBindingInfo.model + "' in ", oElement);
					}
					sResolvedPath = oModel.resolve(oBindingInfo.path,
						oWithControl.getBindingContext(oBindingInfo.model));
					if (!sResolvedPath) {
						error("Cannot resolve path for ", oElement);
					}
					vHelperResult = oModel.createBindingContext(sResolvedPath);
					if (sHelper) {
						fnHelper = getObject(sHelper);
						if (typeof fnHelper !== "function") {
							error("Cannot resolve helper for ", oElement);
						}
						vHelperResult = fnHelper(vHelperResult);
					}
					oPromise = SyncPromise.resolve(vHelperResult);
					if (oViewInfo.sync && oPromise.isPending()) {
						error("Async helper in sync view in ", oElement);
					}
					oPromise = oPromise.then(function (vHelperResult) {
						if (vHelperResult instanceof Context) {
							oModel = vHelperResult.getModel();
							sResolvedPath = vHelperResult.getPath();
						} else if (vHelperResult !== undefined) {
							if (typeof vHelperResult !== "string" || vHelperResult === "") {
								error("Illegal helper result '" + vHelperResult + "' in ",
									oElement);
							}
							sResolvedPath = vHelperResult;
						}
						oNewWithControl.setModel(oModel, sVar);
						oNewWithControl.bindObject({
							model : sVar,
							path : sResolvedPath
						});
					});
				} else {
					sResolvedPath = sPath;
					oNewWithControl.bindObject(sResolvedPath);
					oPromise = oSyncPromiseResolved;
				}

				return oPromise.then(function () {
					iNestingLevel++;
					debug(oElement, sVar, "=", sResolvedPath);
					if (oNewWithControl.getBindingContext(sVar)
							=== oWithControl.getBindingContext(sVar)) {
						// Warn and ignore the new "with" control when its binding context is
						// the same as a previous one.
						// We test identity because models cache and reuse binding contexts.
						warn(oElement, 'Set unchanged path:', sResolvedPath);
						oNewWithControl = oWithControl;
					}

					return liftChildNodes(oElement, oNewWithControl).then(function () {
						oElement.parentNode.removeChild(oElement);
						debugFinished(oElement);
						iNestingLevel -= 1;
					});
				});
			}
/**
			 * Processes a <template:with> instruction.
			 *
			 * @param {Element} oElement
			 *   the <template:with> XML DOM element
			 * @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
			 *   <template:with> instruction has been fully processed, or is rejected with a
			 *   corresponding error if visiting of child nodes fails.
			 * @throws {Error}
			 *   If the "var" attribute is present with an empty value, or if the "path" attribute
			 *   refers to a missing model, or if the "helper" attribute does not refer to a
			 *   function which is currently in scope, or if that helper function returns a result
			 *   which is not a non-empty string.
			 */
Processes a  instruction.
@param {Element} oElement
the  XML DOM element
@param {sap.ui.core.util._with} oWithControl
the parent's "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with undefined as soon as the
 instruction has been fully processed, or is rejected with a
corresponding error if visiting of child nodes fails.
Processes a instruction . @param { Element } oElement the XML DOM element @param { sap . ui . core . util . _with } oWithControl the parent ' s " with " control @returns { sap . ui . base . SyncPromise } A sync promise which resolves with undefined as soon as the instruction has been fully processed or is rejected with a corresponding error if visiting of child nodes fails .
function templateWith(oElement, oWithControl) {
				var oBindingInfo,
					oModel,
					oNewWithControl,
					fnHelper,
					sHelper = oElement.getAttribute("helper"),
					vHelperResult,
					sPath = oElement.getAttribute("path"),
					oPromise,
					sResolvedPath,
					sVar = oElement.getAttribute("var");
				if (sVar === "") {
					error("Missing variable name for ", oElement);
				}
				oNewWithControl = new With();
				oWithControl.setChild(oNewWithControl);
				oBindingInfo = BindingParser.simpleParser("{" + sPath + "}");
				sVar = sVar || oBindingInfo.model; 
				if (sHelper || sVar) { 
					oModel = oWithControl.getModel(oBindingInfo.model);
					if (!oModel) {
						error("Missing model '" + oBindingInfo.model + "' in ", oElement);
					}
					sResolvedPath = oModel.resolve(oBindingInfo.path,
						oWithControl.getBindingContext(oBindingInfo.model));
					if (!sResolvedPath) {
						error("Cannot resolve path for ", oElement);
					}
					vHelperResult = oModel.createBindingContext(sResolvedPath);
					if (sHelper) {
						fnHelper = getObject(sHelper);
						if (typeof fnHelper !== "function") {
							error("Cannot resolve helper for ", oElement);
						}
						vHelperResult = fnHelper(vHelperResult);
					}
					oPromise = SyncPromise.resolve(vHelperResult);
					if (oViewInfo.sync && oPromise.isPending()) {
						error("Async helper in sync view in ", oElement);
					}
					oPromise = oPromise.then(function (vHelperResult) {
						if (vHelperResult instanceof Context) {
							oModel = vHelperResult.getModel();
							sResolvedPath = vHelperResult.getPath();
						} else if (vHelperResult !== undefined) {
							if (typeof vHelperResult !== "string" || vHelperResult === "") {
								error("Illegal helper result '" + vHelperResult + "' in ",
									oElement);
							}
							sResolvedPath = vHelperResult;
						}
						oNewWithControl.setModel(oModel, sVar);
						oNewWithControl.bindObject({
							model : sVar,
							path : sResolvedPath
						});
					});
				} else {
					sResolvedPath = sPath;
					oNewWithControl.bindObject(sResolvedPath);
					oPromise = oSyncPromiseResolved;
				}
				return oPromise.then(function () {
					iNestingLevel++;
					debug(oElement, sVar, "=", sResolvedPath);
					if (oNewWithControl.getBindingContext(sVar)
							=== oWithControl.getBindingContext(sVar)) {
						warn(oElement, 'Set unchanged path:', sResolvedPath);
						oNewWithControl = oWithControl;
					}
					return liftChildNodes(oElement, oNewWithControl).then(function () {
						oElement.parentNode.removeChild(oElement);
						debugFinished(oElement);
						iNestingLevel -= 1;
					});
				});
			}
function templateWith ( oElement , oWithControl ) { var oBindingInfo , oModel , oNewWithControl , fnHelper , sHelper = oElement . getAttribute ( "helper" ) , vHelperResult , sPath = oElement . getAttribute ( "path" ) , oPromise , sResolvedPath , sVar = oElement . getAttribute ( "var" ) ; if ( sVar === "" ) { error ( "Missing variable name for " , oElement ) ; } oNewWithControl = new With ( ) ; oWithControl . setChild ( oNewWithControl ) ; oBindingInfo = BindingParser . simpleParser ( "{" + sPath + "}" ) ; sVar = sVar || oBindingInfo . model ; if ( sHelper || sVar ) { oModel = oWithControl . getModel ( oBindingInfo . model ) ; if ( ! oModel ) { error ( "Missing model '" + oBindingInfo . model + "' in " , oElement ) ; } sResolvedPath = oModel . resolve ( oBindingInfo . path , oWithControl . getBindingContext ( oBindingInfo . model ) ) ; if ( ! sResolvedPath ) { error ( "Cannot resolve path for " , oElement ) ; } vHelperResult = oModel . createBindingContext ( sResolvedPath ) ; if ( sHelper ) { fnHelper = getObject ( sHelper ) ; if ( typeof fnHelper !== "function" ) { error ( "Cannot resolve helper for " , oElement ) ; } vHelperResult = fnHelper ( vHelperResult ) ; } oPromise = SyncPromise . resolve ( vHelperResult ) ; if ( oViewInfo . sync && oPromise . isPending ( ) ) { error ( "Async helper in sync view in " , oElement ) ; } oPromise = oPromise . then ( function ( vHelperResult ) { if ( vHelperResult instanceof Context ) { oModel = vHelperResult . getModel ( ) ; sResolvedPath = vHelperResult . getPath ( ) ; } else if ( vHelperResult !== undefined ) { if ( typeof vHelperResult !== "string" || vHelperResult === "" ) { error ( "Illegal helper result '" + vHelperResult + "' in " , oElement ) ; } sResolvedPath = vHelperResult ; } oNewWithControl . setModel ( oModel , sVar ) ; oNewWithControl . bindObject ( { model : sVar , path : sResolvedPath } ) ; } ) ; } else { sResolvedPath = sPath ; oNewWithControl . bindObject ( sResolvedPath ) ; oPromise = oSyncPromiseResolved ; } return oPromise . then ( function ( ) { iNestingLevel ++ ; debug ( oElement , sVar , "=" , sResolvedPath ) ; if ( oNewWithControl . getBindingContext ( sVar ) === oWithControl . getBindingContext ( sVar ) ) { warn ( oElement , 'Set unchanged path:' , sResolvedPath ) ; oNewWithControl = oWithControl ; } return liftChildNodes ( oElement , oNewWithControl ) . then ( function ( ) { oElement . parentNode . removeChild ( oElement ) ; debugFinished ( oElement ) ; iNestingLevel -= 1 ; } ) ; } ) ; }
Processes a <template:with> instruction.
Processes a <template : with > instruction .
// default variable is same model name // create a "named context" // Warn and ignore the new "with" control when its binding context is // the same as a previous one. // We test identity because models cache and reuse binding contexts.