From: Björn Boxstart <Boxstart(_at_)dcdds(_dot_)nl>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: [xsl] xhtml and different namespace
Date: Wed, 11 Jun 2003 09:37:29 +0200
Hello,
Ik have a strange problem with a document that I want to process. The
document conforms to the XHTML dtd. The only thing I want to do is remove
the DTD declaration and add a new top element. Although I set the output
method to be xml, the document always is being returned as xhtml with the
xhtml namespace.
I want to transform this resulting document (see below) with another xsl-t
stylesheet.
<?xml version="1.0" encoding="UTF-8"?>
<Iisg source="biografie"><biography>
<xhead>
<meta xmlns="http://www.w3.org/1999/xhtml" name="generator"
content="HTML Tidy for Windows (vers 1st August 2002), see www.w3.org"/>
<meta xmlns="http://www.w3.org/1999/xhtml" http-equiv="content-type"
content="text/html; charset=iso-8859-1"/>
<link href="styles/bwsa.css" type="text/css" rel="stylesheet"/>
<title xmlns="http://www.w3.org/1999/xhtml">Piet Aalberse</title>
</xhead>
<body xmlns="http://www.w3.org/1999/xhtml" bgcolor="#ffffff">
<table>
... more data to go here ...
</table>
</body>
</Iisg>
My problem is that the elements that have the namespace declaration as an
attribute seem to have a prefix and therefore are not processed by my
templates.
Something like match='title' doesn't work on a template while
match="*[local-name() = 'title']" does. When I want to display the prefix
(e.g. by <xsl:value-of select="substring-before(name(),':')" this doesn't
return anything at all.
It looks like when I make a template for the body element like:
<xsl:template match="*[local-name() = 'body']">
<xsl:apply-templates select="table" />
</xsl:template>
This doesn't seem to work because it looks like the table is part of
another namespace as the body element. Does anybody know what I'm doing
wrong? I tried several processors and they all have sort of the same
result, so I think that I'm the problem and not the processor ;-(
Thanks in advance!
Best regards,
bjorn
I believe you just need to declare the xhtml namespace witha prefix in your
stylesheet, usually don in the xsl:stylesheet element e.g.:
xmlns:xhtml="http://www.w3.org/1999/xhtml"
then you can match with:
match="xhtml:body"
--
Joe
_________________________________________________________________
Express yourself with cool emoticons - download MSN Messenger today!
http://www.msn.co.uk/messenger
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list