Problem with <head><title>

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Sandrine

Problem with <head><title>

Post by Sandrine »

Hello,

Can you tell me why, when I write this in the beginning of my xsl, Oxygen successful in transform my xml but the xhtml page is empty :

Code: Select all


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/root">
<html>
<head>
<title>MyTitle</title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="book/author">
<h2>Author</h2>
...
If I write this, Oxygen can display the result but not the title :

Code: Select all


   ...
<xsl:template match="/root">
<html>
<title>MyTitle</title>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="book/author">
<h2>Author</h2>
...
Otherwise, if I write this, Oxygen can display the result and the title :

Code: Select all


   ...
<xsl:template match="/root">
<html>
<h1>MyTitle</h1>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="book/author">
<h2>Author</h2>
...
Thank you for your help.

Sandrine
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Sandrine,

Please note that the view you are refering to is for XHTML. When you put method="html" the XSLT processor (Xalan) will generate a meta element without a closing tag which makes the result not well formed, thus the XHTML view fails to render it. You can configure the transformation to save the result to a file and then activate the "open in browser" option to see it in the default browser.

The title element should be present in html/head only and is not considered part of the flow of text. It should be displayed, for example as the page header or window title. So you may try something like:

Code: Select all


<html>
<head>
<title>My title</title>
</head>
<body>
<h1> My title </h1>
</body>
</html>
Best Regards,
George
Post Reply