This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: xsl/xml


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@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of Simon Choy
Sent: Tuesday, May 07, 2002 15:33
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]