[xslt] Parsing bug? Or user not fully spec compliant?
- From: Lars Kellogg-Stedman <thelars yahoo com>
- To: xslt gnome org
- Subject: [xslt] Parsing bug? Or user not fully spec compliant?
- Date: Thu, 8 Nov 2001 11:18:06 -0800 (PST)
I'm following a fairly well trod path by trying to generate HTML from
XML via xsltproc. Unfortunately, I've run into a difference in
behavior between xsltproc and 4xslt (the xslt processor from 4suite).
Given the following xml source:
<?xml version="1.0"?>
<foo:document xmlns:foo='http://foo/'
xmlns='http://www.w3.org/TR/xhtml1/strict'>
<foo:head>
<foo:title>This is a test</foo:title>
</foo:head>
<foo:body>
<h2>How much would would a wood chuck chuck?</h2>
<p>A wood chuck would chuck as much as he could
if a wood chuck could chuck wood...</p>
</foo:body>
</foo:document>
And the following stylesheet:
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:foo='http://foo/'
xmlns='http://www.w3.org/TR/xhtml1/strict'>
<xsl:output method="html" indent="yes"/>
<xsl:template match="foo:document">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="foo:head"/>
<xsl:template match="foo:body">
<body>
<xsl:apply-templates/>
</body>
</xsl:template>
<xsl:template match="h2">
<h2><xsl:value-of select="."/></h2>
</xsl:template>
</xsl:stylesheet>
I would expect the output to look (something) like this:
<html>
<body>
<h2>How much would would a wood chuck chuck?</h2>
A wood chuck would chuck as much as he could if a wood chuck
could chuck wood...
</body>
</html>
And this is what I get with 4xslt. However, if I try to parse this
with xsltproc, the verbose output says:
xsltProcessOneNode: no template found for h2
And the output is:
<html>
<body>
How much would would a wood chuck chuck?
A wood chuck would chuck as much as he could
if a wood chuck could chuck wood...
</body>
</html>
In other words, the <h2> element is not matching the h2 template when
the document is processed with xsltproc. Is this a bug in the
xsltproc? Or is my stylesheet malformed?
Thanks for your help,
-- Lars
=====
lars@larsshack.org --> http://www.larsshack.org/
__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]