Steven SullivanSteven Sullivan - 19th June 2009

So if you’re using DOMPDF and getting this DOMXPath error.. well it’s because you’re using valid HTML (yay!). For more information on how to quickly fix it, read on!

PHP Warning: DOMXPath::query()

PHP Warning:  DOMXPath::query() [<a href='function.DOMXPath-query'>function.DOMXPath-query</a>]: Invalid expression in /home/pdf/include/stylesheet.cls.php on line 573

Ah! Styles these days on pages are wrapped round <!– and –> to make them safe for browsers, bots, validators, etc.

When using DOMPDF, make sure you remove those tags because your CSS styles will never show!