Docunext

  • About

XSLT and Entities

May 3rd, 2007

The XML and XSLT functions in PHP handle entities in the following manner:

  1. DOM document loads the actual XSL as an XML document first. As this point, the DOM object can substituteEntities declared in the doctype for you.
  2. After that, the XsltProcessor will not substitute entities without a DTD handy.
  3. When the XsltProcessor encounters an import or include function, it will load the additional xsl stylesheet, but if it encounters an entity that has not been declared via a DTD, it will throw a fatal error.

Therefore, don't put entities in your included stylesheets. There may be a way that I am unaware of, and I'm pretty much posting this as a reminder to myself.

Related Info:

PHP.net comments 54777 (XML Catalogs for speedy DTD Resolution), 57274 (Local storage of XML entity catalogs), and Whump.com XML Catalogs are very important - great post - references not only Marc Liyanage, but also Christian Stocker (even though Marc's name is spelled wrong!).

Yearly Indexes: 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020