Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 3rd, 2008, 06:02 PM
Authorized User
 
Join Date: Jun 2003
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Fundamental namespace problem?

In the .xml file, I declare:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="CatalogItem.xsl"?>
<catalogItem xmlns="http://www.fineHomemadeSoap.com/Catalog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://www.fineHomemadeSoap.com/Catalog
        CatalogItem.xsd"
    >
    <sortProperty>Lavender</sortProperty>
...


When I do this, the CatalogItem.xsl file is not applied, and the .xml file's text is displayed in the browser, with all the tags stripped-out.

If I change the heading as follows, everything works properly:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="CatalogItem.xsl"?>
<catalogItem
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://www.fineHomemadeSoap.com/Catalog
        CatalogItem.xsd"
    >
    <sortProperty>Lavender</sortProperty>
...



Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
__________________
Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
 
Old January 3rd, 2008, 06:40 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Please read the first "sticky" post in this forum, or google for "XSLT default namespace".

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 3rd, 2008, 08:20 PM
Authorized User
 
Join Date: Jun 2003
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael Kay,
I have your book, "XSLT 2.0," 3rd Ed. I bought it to supplement my XML course. I also have "Beginning XML," 3rd, whereas I don't see your name on the authors. Your book helps tremendously. When I took the class, I got more out of your book (for one lesson) than the required textbook.

I understand the message of your post is to perform adequate research in advance before making a post. However, I assure you that I have many hours in this topic. I am on vacation, and for 4 days, this has been a major project. That's probably 30-40 hours. I wouldn't make this post if I didn't have a large amount of advance work involved.

There is something in the dynamics of transforming one .xml file into another, if a default namespace is named in the original document, and I don't understand why.

For 4 days, this has been bugging me. I don't like to make changes in a document without understanding.

Please don't get me wrong. I am very grateful for responses, and I would even be grateful for a reference to go read.

Interestingly, in your book, p.66, I see a default namespace is not defined in the source document.




Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
 
Old January 3rd, 2008, 09:04 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>I have your book, "XSLT 2.0," 3rd Ed.

Please see the discussion on pp442-444.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 6th, 2008, 06:24 AM
Authorized User
 
Join Date: Jun 2003
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mr. Kay,
Thank you very much for the reference.
My browser only honors XSLT 1.0, so I do not have xpath-default-namespace.

As an amend, I tried to figure out how to refer to a specific namespace node using xpath (an experiment all the way):

<xsl:value-of select="catalogItem/test"/>
or: <xsl:value-of select="cat:catalogItem/test"/> (ambiguous-should be an error)

, but I think it'll work if I have a null default namespace in the .xml source document.

I'll continue to investigate the XPath naming rules, in case I'm missing something.

Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Something Fundamental Clem BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 5 November 24th, 2008 11:41 AM
Namespace problem Harshal123 BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 1 October 21st, 2008 06:35 AM
Namespace problem adwaitjoshi ASP.NET 2.0 Professional 0 March 28th, 2007 10:04 PM
namespace problem olambe BOOK: ASP.NET Website Programming Problem-Design-Solution 3 May 21st, 2004 12:08 PM
namespace problem marclena XSLT 1 February 12th, 2004 03:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.