Search

I have an empty xmlns attribute appearing in elements that are from imported stylesheets.

For example, the divs in my “master” page template do not have this emprty xmlns attribute, but the divs for the sidebar and page content, which are generated from imported utilities, do have them.

Any ideas as to what is happening here? Disclaimer - I am a newbie, be gentle!!

I am aware that this has come up before from searching the forums, but I couldn’t find anything conclusive.

Are you setting a default namespace for your output elements (such as xhtml) in your included utility templates? If not then what may be happening is that the imported XSLT is outputting an element in the ‘null’ namespace, hence the xmlns=”. This would happen you’ve declared a default namespace in a parent output element (like html).

So for example if you are using a ‘master’ XSLT template, which declares the xhtml namespace for its output elements, then you are using the included XSLT to output an element that is supposed to be xhtml inside the “master’s” output, since you have not also declared that element to be in the xhtml namespace in the included XSLT, the processor is explicitly declaring the ‘null’ namespace your included output element belongs to.

Long story short, try setting the default namespace of the elements getting xmlns=” to whatever they are meant to be in the included XSLT(probably xhtml 1 I assume).

If that doesn’t work , you could try exclude-result-prefixes="" in your stylesheetor transform element; however that would just fix the symptoms but not effect the cause IMHO.

That did the trick just fine, thanks a lot.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details