Referencing XSD Schema in XSLT

V

Vijay

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
 
V

Vijay

Richard said:
This should probably be xmlns:xsl="http://www.w3.org/1999/XSL/Transform".


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
 
M

Martin Honnen

Vijay said:
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"
 
V

Vijay

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top