473,806 Members | 2,582 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Could someone help me out with my namespace problems in my XSD

Could someone help me out with the following?

I've got
1)an xml file
2)an xsl
3)a schema

My namespaces are as follow

molecular_db.xm l
<database
xmlns="http://www.mine.com"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://www.mine.com mdb_schema.xsd"

mdb_schema.xsd
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.mine.com"
targetNamespace ="http://www.mine.com"
elementFormDefa ult="qualified" >

dB_ss.xsl
<xsl:styleshe et version = "1.0"
xmlns="http://www.mine.com"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"


When I try it out in XMLWriter I keep getting an error that states I
can't use xs:element in the context defined as
xsi:schemaLocat ion="http://www.mine.com mdb_schema.xsd" .

Hence, all I get for output are the headers I defined in the xsl. Take
away the xsd declarations and everything is fine. Better yet, take-away
the xmlns declaration in my xml file and it doesn't look for the xsd and
the file displays fine, headers and data all formatted by the xsl.
What's wrong with my file and how do I fix it?

Jan 20 '06 #1
5 1472


Mike_August wrote:

My namespaces are as follow

molecular_db.xm l
<database
xmlns="http://www.mine.com"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://www.mine.com mdb_schema.xsd"
>


mdb_schema.xsd
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.mine.com"
targetNamespace ="http://www.mine.com"
elementFormDefa ult="qualified" >

dB_ss.xsl
<xsl:styleshe et version = "1.0"
xmlns="http://www.mine.com"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"


If your XSLT stylesheet is supposed to have XPath expressions and match
patterns matching any of the elements in the http://www.mine.com
namespace then you need a prefix e.g.
xmlns:pf="http://www.mine.com"
bound to the namespace URI and then use that prefix e.g.
<xsl:template match="pf:datab ase">
That has to happen in the XSLT stylesheet only so no change to the XML
or schema is needed.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 20 '06 #2
Martin Honnen wrote:


Mike_August wrote:

My namespaces are as follow

molecular_db.xm l
<database
xmlns="http://www.mine.com"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://www.mine.com mdb_schema.xsd"
>


mdb_schema.xsd
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.mine.com"
targetNamespace ="http://www.mine.com"
elementFormDefa ult="qualified" >

dB_ss.xsl
<xsl:styleshe et version = "1.0"
xmlns="http://www.mine.com"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"

If your XSLT stylesheet is supposed to have XPath expressions and match
patterns matching any of the elements in the http://www.mine.com
namespace then you need a prefix e.g.
xmlns:pf="http://www.mine.com"
bound to the namespace URI and then use that prefix e.g.
<xsl:template match="pf:datab ase">
That has to happen in the XSLT stylesheet only so no change to the XML
or schema is needed.

I'm not using a template. Besides if I change xsl:stylesheet to
xsl:template match="pf:datab ase: and place mlns:pf="http://www.mine.com"
in my database xml file then I just get a 'xsl:stylesheet ' does not
match start tag 'xsl:template'. And so this does not solve the problem.

Mike
Jan 20 '06 #3


Mike_August wrote:

I'm not using a template. Besides if I change xsl:stylesheet to
xsl:template match="pf:datab ase: and place mlns:pf="http://www.mine.com"
in my database xml file then I just get a 'xsl:stylesheet ' does not
match start tag 'xsl:template'. And so this does not solve the problem.


So your XSLT stylesheet is empty besides the xsl:stylesheet element?
Surely you have
xsl:template
instructions in your XSLT stylesheet? Hmm, indeed you have only
<xsl:template match="/">
but of course I wrote the above as an example and explictly mentioned
XPath expressions and match patterns.
The advice is correct, the stylesheet needs to bind a prefix to the
namespace URI and the XPath expressions need to use that e.g.
<xsl:for-each select="pf:data base/pf:molecule">
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 20 '06 #4
Martin Honnen wrote:


Mike_August wrote:

I'm not using a template. Besides if I change xsl:stylesheet to
xsl:template match="pf:datab ase: and place mlns:pf="http://www.mine.com"
in my database xml file then I just get a 'xsl:stylesheet ' does not
match start tag 'xsl:template'. And so this does not solve the problem.

So your XSLT stylesheet is empty besides the xsl:stylesheet element?
Surely you have
xsl:template
instructions in your XSLT stylesheet? Hmm, indeed you have only
<xsl:template match="/">
but of course I wrote the above as an example and explictly mentioned
XPath expressions and match patterns.
The advice is correct, the stylesheet needs to bind a prefix to the
namespace URI and the XPath expressions need to use that e.g.
<xsl:for-each select="pf:data base/pf:molecule">


Right, did you check your advice on my file? I'll check it out soon. So
I'm supposed to apply the pf namespace for all elements, or just the
for-each tags?
Jan 22 '06 #5


Mike_August wrote:

So
I'm supposed to apply the pf namespace for all elements, or just the
for-each tags?


Any XPath expression to match/select elements in that namespace needs to
have prefix:localnam e and not simply localname.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 24 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
1676
by: Ryan Paul | last post by:
I've spent a lot of time using python, and personally, I feel like it is vastly superior when compared to languages like java, and c++, but there are still a few things that detract from its elegance and flexibility. I thought I might mention a few of them. I'd like to hear what people think of my complaints, and I also like to hear the complaints of others. 1. many keywords (eg:try/except) are strictly imperative, and cannot be used in...
2
1673
by: Martin Magnusson | last post by:
I'm including a library in my program that I have wrapped in a namespace, since it contains typdefes that clash with my own. Like this: namespace OPT{ #include "OPT/NLP.h" #include "OPT/NLF.h" } When compiling, I get a number of undefined references to code in
2
1543
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="Loan"> <xs:complexType> <xs:sequence> <xs:element name="Borrower" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="BorrID" use="required">
1
1974
by: amir | last post by:
Hi, When compiling a page in VS2005 this morning I received 101 messages regarding schema problems in my web.config file. When I go to view an aspx page in my IIS, IE just displays a blank page. I have the June Atlas CTP installed.
3
2869
by: sjt003 | last post by:
I have been developing web apps in Visual Studio 2003, but since the other developers in my office don't use Visual Studio, I may have to stop too unless there is an efficient way for them to compile the code outside of Visual Studio if they need to adjust something I created. I have been trying to use vbc.exe, but I'm having problems with references to the DataSet I have created. Multiple pages reference my dataset - "DataSet1", ......
2
6971
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
0
1465
by: Sky | last post by:
Hi, Like many others, I've search the newsgroups and KB's and none quite seem to be the problem I am encountering. The problem is as follows: 1) I originally created an ASP.Net Web Application and developed the app as normal. In doing this, when running the app, VS2005 creates a Virtual Server with it's own port number to host the application in - fine, no problems.
8
13222
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project compiles & runs fine locally, but when I copy to the production machine, I get this error: Parser Error Message: Could not load type 'Global'. Source Error: Line 1: <%@ Application Codebehind="Global.asax.vb" Inherits="Global" %> Source...
4
1686
by: karen.homersham | last post by:
Just working through Apress Pro ASP NET.2.0.E Commerce in C Sharp. I am having problems compiling the following: using System; using System.Collections.Generic; using System.Text; namespace ECommerce.Common { public class Users
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10369
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5682
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.