473,508 Members | 2,267 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Referencing XSD Schema in XSLT

I had a following xslt :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Format" >
</xsl:stylesheet>

and then I referenced a XSD in xsl:stylesheet element as follows :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Format"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/XSL/Format
C:\FOP-SRC\fop-0.20.5\src\foschema\fop.xsd">

</xsl:stylesheet>

When I validated this in XML spy it gives me following error :

"The file is not valid: The element declaration was not found for root
element 'xsl:stylesheet'"
Can anybody see the problem?

Regards
Vijay

Oct 31 '05 #1
5 2898
In article <11**********************@z14g2000cwz.googlegroups .com>,
Vijay <vi*******@hotmail.com> wrote:
xmlns:xsl="http://www.w3.org/1999/XSL/Format"
This should probably be xmlns:xsl="http://www.w3.org/1999/XSL/Transform".
xsi:schemaLocation="http://www.w3.org/1999/XSL/Format
C:\FOP-SRC\fop-0.20.5\src\foschema\fop.xsd">


xsi:schemaLocation maps namespace names to URIs, not filenames. Try
something like file://C:/FOP-SRC/fop-0.20.5/src/foschema/fop.xsd.

-- Richard
Nov 1 '05 #2

Richard Tobin wrote:
In article <11**********************@z14g2000cwz.googlegroups .com>,
Vijay <vi*******@hotmail.com> wrote:
xmlns:xsl="http://www.w3.org/1999/XSL/Format"


This should probably be xmlns:xsl="http://www.w3.org/1999/XSL/Transform".
xsi:schemaLocation="http://www.w3.org/1999/XSL/Format
C:\FOP-SRC\fop-0.20.5\src\foschema\fop.xsd">


xsi:schemaLocation maps namespace names to URIs, not filenames. Try
something like file://C:/FOP-SRC/fop-0.20.5/src/foschema/fop.xsd.

-- Richard


Thanks Richard, I tired all of above, but XML Spy complains as before
about <xsl:stylesheet> element. I was just wondering if it is legal to
have xsd reference in xsl:stylesheet element

Nov 1 '05 #3


Vijay wrote:
but XML Spy complains as before
about <xsl:stylesheet> element. I was just wondering if it is legal to
have xsd reference in xsl:stylesheet element


Well you need a schema then defines the elements in the XSLT namespace
http://www.w3.org/1999/XSL/Transform and that then manages to allow the
literal result elements such a stylesheet can have.
And in your original post you had

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Format"

where I assume you want

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 1 '05 #4

Martin Honnen wrote:
Vijay wrote:
but XML Spy complains as before
about <xsl:stylesheet> element. I was just wondering if it is legal to
have xsd reference in xsl:stylesheet element


Well you need a schema then defines the elements in the XSLT namespace
http://www.w3.org/1999/XSL/Transform and that then manages to allow the
literal result elements such a stylesheet can have.
And in your original post you had

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Format"

where I assume you want

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
--

Martin Honnen
http://JavaScript.FAQTs.com/

I tried that after Richard pointed out. It still gives the error.

Vijay

Nov 1 '05 #5


Vijay wrote:
I tried that after Richard pointed out. It still gives the error.


Does that schema you use define any element named stylesheet in the
namespace http://www.w3.org/1999/XSL/Transform?
It does not help to reference a schema that does not define the elements
you use.
You need
xsi:schemaLocation="http://www.w3.org/1999/XSL/Transform
URLToSchemaForThatNamespaceHere"

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 1 '05 #6

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

Similar topics

6
2476
by: Pieter | last post by:
I've read a lot of posts on "why relax ng is so very good" and on "why w3c xml schema should be the only schema language". I'm, however, still not clear on why I should prefer one over the other. ...
0
2162
by: Adam Retter | last post by:
Hi Guys, I have a need to create a html form based on my schema. I initially decided to do this using xql, have got some way but am finding this difficult (it may be as I am very new to xql)....
1
1208
by: thijs.kupers | last post by:
Hi Anyone knows where I can find the xml-schema of xslt? thanks...
6
2558
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
0
807
by: DC Gringo | last post by:
If I create a new xmlDoc from a DataSet (derived from SQL data) such as: Dim myDataSet As DataSet = New DataSet ' code here to populate the DataSet with schema and data. Dim xmlDoc As...
3
1211
by: Jeff Calico | last post by:
Hi I have what I think is a easy question about how to pull cross reference data when I transform my XML file. I can't seem to find a good example of how to do this on the web, though. Here...
2
1104
by: parth | last post by:
I have the following XML file - <root> <book> <section>art</section> <title>abc</title> <author>mark</author> </book> <book> <section>science</section>
5
7255
by: hello | last post by:
How can I define the schema so that myage element has to be double or null? <xs:simpleType name="myage"> <xs:restriction base="xs:double"> <xs:enumeration value="null"/> </xs:restriction>...
9
2986
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7120
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...
0
7380
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...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5050
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...
0
3192
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...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
415
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...

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.