Re: [xsl] xhtml output formating problems / passing through pre defined static xhtml

Subject: Re: [xsl] xhtml output formating problems / passing through pre defined static xhtml
From: "cking" <cking@xxxxxxxxxx>
Date: Thu, 9 Sep 2004 15:28:34 +0200
Emmanouil Batsis wrote:
>
> Dominic Kr|ger wrote:
>
> >I am trying to write a xhtml file that consist of some static areas (pre
> >formated xhtml)and some dynamic areas I want to fill with content from an
> >xml file.
> >
> >
> Uppercase characters in element attribute names like SCRIPT and ONLOAD
> make your XHTML invalid. Elements named 'XML' make your document invalid
> XML [1]! I guess this has to do with the activex stuff...
>

In addition to that: in my browser, I see special characters
displayed differently in hamburg.htm and in test.htm:

    hamburg.htm: "Hamburg f|r Gehvrlose"
    test.htm: "Hamburg fC<r GehC6rlose"

Probably this is caused by the encoding specified in the xml declaration
(also note different DOCTYPE):

    --- hamburg.htm ---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
... contents probably in "iso-8859-1" encoding?

    --- test.htm ---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
... contents probably in "UTF-8" encoding, but not recognized by browser

Add <meta http-equiv="content-type" content="text/html;charset=UTF-8"/> to test.htm,
and it will display correctly.

    --- test.xslt ---
o;?<?xml version="1.0" encoding="UTF-8"?>    (note the special characters in the beginning)
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   version="1.0"
   xmlns="http://gebaerden.hamburg.de/XSLT-styles";
>
 <xsl:param name="contextPath"/>
 <xsl:output cdata-section-elements="script"/>
 ...

You have xsl:stylesheet xmlns="http://gebaerden.hamburg.de/XSLT-styles";
which probably should be xmlns="http://www.w3.org/1999/xhtml";
and then you could try adding an output method like

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

maybe also add omit-xml-declaration="yes" and/or specify another encoding
and/or use other doctype, and then add the meta tag to your html/head:

<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>

HTH?
Anton Triest

> >Stylesheet : http://www.zeitdesigner.de/xslt/test.xslt
> >Output xhtml: http://www.zeitdesigner.de/xslt/test.htm
> >
> >
>
> Your pipeline uses the correct serializer AFAIK so I'm afraid we cannot
> help you without you posting a sample XML source document, pointing out
> the markup that gets lost.
>
> [1] http://www.w3.org/TR/REC-xml/#sec-logical-struct
>
> Manos

Current Thread