Closed Bug 299885 Opened 19 years ago Closed 19 years ago

XML + XSLT with xsl:apply-templates to XHTML - doctype (node type?) problem

Categories

(Core :: XSLT, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: guntiso, Assigned: peterv)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050702
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050702

Some nodes are not rendered as html after transforming xml to xhtml if
xsl:apply-templates is used.

Reproducible: Always

Steps to Reproduce:
1. file test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>

<page><data>SomeData</data></page>

2. file test.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

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

<xsl:template match="/">
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <title>Title</title>
    </head>
    <body>
      <h1>Heading</h1>
      <xsl:apply-templates/>
    </body>
  </html>
</xsl:template>

<xsl:template match="data">
  <h1>Heading</h1>
</xsl:template>

</xsl:stylesheet>

3. open test.xml in browser
Actual Results:  
Only the first heading is rendered as heading

Expected Results:  
Render both headings the same
The <h1> element in the second template is not in the xhtml namespace and will
therefor not be an xhtml element. Move the xmlns="http://www.w3.org/1999/xhtml"
attribute to the xsl:stylesheet element and it should work fine.

This is according to spec.

In general I don't recommend using xhtml unless you really know what you're
doing and want to deal with the fact that IE doesn't support it.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.