[xml/sgml-pkgs] Bug#399875: libxslt1.1: exclude-result-prefixes not honored (regression)

Vincent Lefevre vincent at vinc17.net
Mon Mar 4 09:55:47 UTC 2013


retitle 399875 xsltproc: document how to manipulate HTML-compatible XHTML
thanks

On 2013-03-03 21:54:18 -0800, Jonathan Nieder wrote:
> retitle 399875 xsltproc: document how to manipulate HTML-compatible XHTML (<xsl:element name="{local-name()}">?)

Using <xsl:element name="{local-name()}"> is a bad idea as the
namespace won't be correct (or will just by chance) in XML.

The solution is to use:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:h="http://www.w3.org/1999/xhtml"
                xmlns="http://www.w3.org/1999/xhtml">

and the default namespace for HTML elements in the templates, e.g.
<br /> and not <h:br />. Both HTML namespace declarations above are
needed: The "xmlns:h" attribute above is needed for XPath (which
cannot use the notion of default namespace) and the "xmlns" is
needed to use the default namespace in order to avoid a prefix in
the output (for compatibility with HTML parsers).

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



More information about the debian-xml-sgml-pkgs mailing list