private static function addParams($dom, $params)
	{
		if(!sizeof($params)) {
			return $dom;
		}
		// get xpath
		$xpath = new DOMXPath($dom);
		//registering namespace xsl
		$xpath->registerNamespace(self::XSLT_SHORT_NS, self::XSLT_NS);
		// get the params tag direct child of the stylesheet (don't touch other params as template for example)
		$items = $xpath->query('/' . self::XSLT_SHORT_NS . ':stylesheet|' . self::XSLT_SHORT_NS . ':transform/' . self::XSLT_SHORT_NS . ':param');
		// list existing to don't duplicate it
		$existing = array();
		foreach ($items as $param) {
			$existing[] = $param->getAttribute('name');
		}
		// for each item in param
		foreach ($params as $name => $val) {
			// if not exist in dom
			if(!in_array($name, $existing)) {
				// we add it to the dom
				$node = $dom->createElementNS(self::XSLT_NS, self::XSLT_SHORT_NS . ":param");
				$node->setAttribute('name', $name);
				// log to say param added dynamically
				common_Logger::w('Parameters "' . $name . '"added automatically by the ' . get_class() . ':addParams \'s function because it was missing in the xsl stylesheet');
			}
		}
		return $dom;
	}
private static function addParams($dom, $params)
	{
		if(!sizeof($params)) {
			return $dom;
		}
		// get xpath
		$xpath = new DOMXPath($dom);
		//registering namespace xsl
		$xpath->registerNamespace(self::XSLT_SHORT_NS, self::XSLT_NS);
		// get the params tag direct child of the stylesheet (don't touch other params as template for example)
		$items = $xpath->query('/' . self::XSLT_SHORT_NS . ':stylesheet|' . self::XSLT_SHORT_NS . ':transform/' . self::XSLT_SHORT_NS . ':param');
		// list existing to don't duplicate it
		$existing = array();
		foreach ($items as $param) {
			$existing[] = $param->getAttribute('name');
		}
		// for each item in param
		foreach ($params as $name => $val) {
			// if not exist in dom
			if(!in_array($name, $existing)) {
				// we add it to the dom
				$node = $dom->createElementNS(self::XSLT_NS, self::XSLT_SHORT_NS . ":param");
				$node->setAttribute('name', $name);
				// log to say param added dynamically
				common_Logger::w('Parameters "' . $name . '"added automatically by the ' . get_class() . ':addParams \'s function because it was missing in the xsl stylesheet');
			}
		}
		return $dom;
	}
private static function addParams ( $ dom , $ params ) { if ( ! sizeof ( $ params ) ) { return $ dom ; } // get xpath $ xpath = new DOMXPath ( $ dom ) ; //registering namespace xsl $ xpath -> registerNamespace ( self :: XSLT_SHORT_NS , self :: XSLT_NS ) ; // get the params tag direct child of the stylesheet (don't touch other params as template for example) $ items = $ xpath -> query ( '/' . self :: XSLT_SHORT_NS . ':stylesheet|' . self :: XSLT_SHORT_NS . ':transform/' . self :: XSLT_SHORT_NS . ':param' ) ; // list existing to don't duplicate it $ existing = array ( ) ; foreach ( $ items as $ param ) { $ existing [ ] = $ param -> getAttribute ( 'name' ) ; } // for each item in param foreach ( $ params as $ name => $ val ) { // if not exist in dom if ( ! in_array ( $ name , $ existing ) ) { // we add it to the dom $ node = $ dom -> createElementNS ( self :: XSLT_NS , self :: XSLT_SHORT_NS . ":param" ) ; $ node -> setAttribute ( 'name' , $ name ) ; // log to say param added dynamically common_Logger :: w ( 'Parameters "' . $ name . '"added automatically by the ' . get_class ( ) . ':addParams \'s function because it was missing in the xsl stylesheet' ) ; } } return $ dom ; }
insert the tag param for each params noexistent in xsl stylesheet
@param DOMPDocument $dom
@return DOMDocument
insert the tag param for each params noexistent in xsl stylesheet