Jump to content

Namespace Problems


MichalAugustyniak

Recommended Posts

Hi. I've got a tiny little database, it could be anything, I'm just testing right now. It displays with my xsl all fine, until I add my root namespace value:XSL

<?xml version = "1.0" ?><xsl:stylesheet version = "1.0" xmlns="http://www.mine.com" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">

XSD

<xs:schema 	xmlns="http://www.mine.com"	xmlns:xs="http://www.w3.org/2001/XMLSchema" 	targetNamespace="Container_Namespace"  	elementFormDefault="qualified">

XML

<?xml version="1.0" encoding="ISO-8859-1" ?><?xml-stylesheet type="text/xsl" href="db_ss.xsl"?><database 	xmlns="http://www.mine.com"	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 	xsi:schemaLocation="http://www.mine.com Container_Namespace%20molecular_db_schema.xsd">

Everything appears fine UNTIL I add the root namespace for the root node: xmlns="http://www.mine.com"Remove it, to get this

<?xml version="1.0" encoding="ISO-8859-1" ?><?xml-stylesheet type="text/xsl" href="db_ss.xsl"?><database 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 	xsi:schemaLocation="http://www.mine.com Container_Namespace%20molecular_db_schema.xsd">

And all seems to look good, but it's like the schema is irrelevant. I can write anything in the schema or in the xml file and it displays only what's defined in the xsl. How do you fix this?Thanks in advance...MikePS: I did take the XML tutorial, it seems to me as though I've placed the namespaces where they were supposed to be. Could someone help me out with this one?

Link to comment
Share on other sites

I'm not sure, but I think that by placing xmlns without :some-kind-of-extension you are killing the XSLT namespace, because by placing the xmlns you are making every child of <xsl:styleshhet> use the namespace www.mine.com instead of making every element which begins with xsl be part of the XSLT stylesheet.As for the irrelavant schema... I have no idea.

Link to comment
Share on other sites

  • 2 weeks later...
I'm not sure, but I think that by placing xmlns without :some-kind-of-extension you are killing the XSLT namespace, because by placing the xmlns you are making every child of <xsl:styleshhet> use the namespace www.mine.com instead of making every element which begins with xsl be part of the XSLT stylesheet.As for the irrelavant schema... I have no idea.

That's the thing, what kind of extension do I need on the xmlns namespace?Thansk for the reply though.
Link to comment
Share on other sites

I don't get it... why do you need your own namespace on the first place? Can't you just use ordinary XML, scince there won't be any special technology applyed? Or am I wrong?

Link to comment
Share on other sites

I don't get it... why do you need your own namespace on the first place? Can't you just use ordinary XML, scince there won't be any special technology applyed? Or am I wrong?

I don't know that far. I looked at the w3schools tutorial really quick and that's what I got is that they plaster the xmlns or "default namespace" in the xml, xsl and xsd files. Another thing is that if I scrap the xmlns from the xml file, I can write anything I want in the schema file and it will be like the schema file never mattered.I looked through that tutorial again and it basically has xmlns="http://www.w3schools.com" as the default namespace in both the xml and schema file. What I don't get is why it blocks the xsl file from formatting the content. The second I remove the default namespace from the xml file, everything formats properly, but the schema file becomes irrelevant..There's definitely a default namespace conflict here. It might be due to the fact tht xml considers all non<xsl:> tagsto be of default namespace, and the xsd's non-<xs:> tags are too. The the xml file itelf also has it s default namespace set to the same value and it impleements the xsd file with the same-valued default namespace. I guess there's a conflict over who gets the default nespace.BAsically, I want the xml file to comply with the schema, and get formatted by the xsl file. That's what I'm looking for.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...