[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Transforming XML doc with namespace

Subject: Transforming XML doc with namespace
From: Mark Edwards <a-marked@xxxxxxxxxxxxx>
Date: Tue, 27 Feb 2001 15:42:41 -0800
transforming xml with namespace
My job this week is to perform some XSLT on someone else's XML document.
This should be straight forward, but I've been thrown a curve ball that I
haven't seen mentioned in other documentation.

My question is: How can I get XSLT to work with this document containing a
namespace?  (Let's assume I can't have the source document fixed.)

I've included a minimal demonstration below including both a source file
that works fine and a source file that demonstrates my problem.


STYLESHEET:
<xsl:stylesheet 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">
<xsl:template match="book">
	<html><body>
	<xsl:value-of select="@category"/><br/>
	<xsl:value-of select="title"/>
	</body></html>
</xsl:template>
</xsl:stylesheet>


SOURCE THAT WORKS:
<?xml version="1.0"?>
<books>
	<book category="reference">
		<author>Nigel Rees</author>
		<title>Sayings of the Century</title>
		<price>8.95</price>
	</book>
</books>
OUTPUT: <html><body>reference<br>Sayings of the Century</body></html>


SOURCE THAT BREAKS:
<?xml version="1.0"?>
<books xmlns="blah.blah.blah">
	<book category="reference">
		<author>Nigel Rees</author>
		<title>Sayings of the Century</title>
		<price>8.95</price>
	</book>
</books>
OUTPUT: <?xml version="1.0" encoding="UTF-16"?>Nigel ReesSayings of the
Century8.95


I don't yet understand why the second source file renders in what seems to
be a ramdom fashon.  Maybe I'm misunderstanding the basics of namespaces.  

Thanks for your input.

-Mark

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.