Search

So the page source looks like that:

My master.xsl code: <?xml version="1.0" encoding="UTF-8"?> Highland Coffee Roastery: Home

XML is pretty strict so anything which isn't valid XML will cause an error. The XSL code you pasted above isn't valid XML. If you haven't already followed through the Hello World tutorial I'd give that a go first as it introduces those basics before expanding on things in the Hello Symphony tutorial. You'll see an example of the XSL file there:

 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet version="1.0"
    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>
            <title>Hello World!</title>
        </head>
        <body>
            <h1>Symphony Greets the World</h1>
            <h2>Greetings</h2>
            <ul>
                <xsl:apply-templates select="/data/greetings/entry"/>
            </ul>
        </body>
    </html>
 </xsl:template>

 <xsl:template match="greetings/entry">
    <li><xsl:value-of select="greeting-text"/></li>
 </xsl:template>

 </xsl:stylesheet>

Hi,

I did follow the first tutorial, again, the problem is I want to use HTML5 and I read a lot of posts about it here, and followed the example from this post: link text

Maybe you can help me a bit and tell me what exactly is not valid in my xml? That is what I am actually asking. I can't find the difference between what I did and what the tutorial has besides the html5 declarations.

Thank you for taking the time.

I'm not sure about your entire template code but from what you included in your post:

<?xml version="1.0" encoding="UTF-8"?> Highland Coffee Roastery: Home

That is either incomplete or not valid XML on it's own. Compare it with the example I copied in. The XML declaration is correct but as it's an XSL file you need to tell it what you want to output. In the case of HTML5 you could do it with the following:

<xsl:output
    method="html"
    doctype-public="XSLT-compat"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

The one caveat with this however is that the code wont indent on output. This is a minor issue but if you want nicely indented code with HTML5 your best bet is to use the HTML5 extension.

Also remember that everything needs to fit within tag pairs in XML so any text elements need a parent node and a corresponding closing tag. So "Highland Coffee Roastery: Home" would need to sit within maybe the <h1> tag in my example above for example. You need to form the complete HTML5 document.

Thank you very much for your answer, that helped me understand where to look for the problem.

Have a great day.

Ok, just one more thing, my code was fine. It was the html 5 declaration that I've tried that broke things.

It looks like the code that I put in my first post does not display so you could not see it.

Anyway, I will try the extension you reccommend.

No problem. XSLT 1.0 was conceived long before the HTML5 doctype was in existence so there is a mis-match there but the HTML5 extension should do the trick and is probably the best bet.

If you need to paste in any code then just highlight the code in the comment textarea and then click on the code button (5th from left - 1's and O's) which will wrap it in a code block. That should display fine.

Post back if you have any other issues.

I use the mentioned HTML5 Doctype extension on daily basis and it works like a charm.

My XSL template looks usually like this, starting (lightweight version):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet  [
<!ENTITY nbsp "&#160;">
    .... or other entities as needed...
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

... xsl imports if any...

... xsl global variables / keys if any (if they are not part of imports above)...

<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="/">
... IE html conditionals if used...
<html ...classes etc...>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>

... and so forth with usual HTML / XSL ...

and it transforms into HTML5 ready page like e.g.:

<!DOCTYPE html>
... conditionals if used ...
<html ...classes etc...>
    <head>
        <meta charset="UTF-8" />
        <title>....

...

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