Subject: RE: xsl/xml
From: "Stuart Celarier" <stuart@xxxxxxxxxxx>
Date: Tue, 7 May 2002 15:57:47 -0700
|
Simon, in your XML file you've used a default namespace (a namespace
without a prefix specified) on the top level element. That means that
<country> and <member> elements are in the namespace associated with the
URI "http://www.w3.org/TR/html4/". Your XSLT file is looking for
<country> and <member> elements that belong to no namespace. Specifying
the namespace these elements will probably fix your problem.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:a1="http://www.w3.org/TR/html4/">
<xsl:template match="/">
<html>
<body>
<xsl:value-of select="a1::country/a1::member" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
That said, "http://www.w3.org/TR/html4/" is an exceedingly poor choice
of namespace URI for your custom <country> and <member> element. I am
sure that is not what you mean. Instead, leave the default namespace
declaration out of the XML file entirely, it does not contain any HTML 4
elements.
Cheers,
Stuart
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Simon Choy
Sent: Tuesday, May 07, 2002 15:33
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: xsl/xml
First of all thank you for all your help last time guys
Staring at the screen too long makes me blind
anyway I have a new question
*sigh*
XML file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="database.xsl"?>
<country xmlns="http://www.w3.org/TR/html4/">
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<member>bob</member>
</country>
XSL file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<html>
<body>
<xsl:value-of select="country/member" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
PROBLEM:
The line <xsl:value-of select="country/member" /> within the XSL
file does not show anything. I have narrowed it down the the namespace
attribute in the XML file that's causing this problem. If i remove the
Namespace attribute from the <country> element, it prints it out fine
ps. this is a simplified version of what I am working on, and in my
version,
the namespace attribute of the root element cannot be removed.
Is there anyway to get around thhis?
TIA
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- xsl/xml
- Simon Choy - Tue, 7 May 2002 18:27:05 -0400 (EDT)
- Mike Brown - Tue, 7 May 2002 18:44:50 -0400 (EDT)
- Stuart Celarier - Tue, 7 May 2002 18:52:06 -0400 (EDT) <=
|
|