Search

I'm using the EXSLT date and time extension on one of my sites. It's all working but something is wrong as the resulting HTML contains a wrong declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:date="http://exslt.org/dates-and-times">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

(See the xmlns:date attribute in the html tag?)

This is the head of the XSL file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
  xmlns:date="http://exslt.org/dates-and-times"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"
  doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  omit-xml-declaration="yes"
  encoding="UTF-8"
  indent="yes" />

<xsl:template match="/">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Does anybody know where my mistake is?

Re-order the stylesheet namespaces and declare the the XSL Transform first, then the EXSLT dates-and-times and then add extension-element-prefixes="date" at end of the stylesheet declaration like so...

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
            xmlns:date="http://exslt.org/dates-and-times" 
            extension-element-prefixes="date">
    <xsl:output method="xml" 
            doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
            doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" 
            omit-xml-declaration="yes" 
            encoding="UTF-8" 
            indent="yes"/>

Thanks, bzerangue, but this doesn't change the resulting HTML. That was the first thing I tried ...

Did you add the extension-element-prefixes="date"? I was getting the same outcome you were until I added that extension namespace.

That's it - thank you! I didn't save my template correctly ...

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