Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Referencing XSD Schema in XSLT

Reply
Thread Tools

Referencing XSD Schema in XSLT

 
 
Vijay
Guest
Posts: n/a
 
      10-31-2005
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"
xmlnssl="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"
xmlnssl="http://www.w3.org/1999/XSL/Format"
xmlnssi="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

 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      10-31-2005
In article <(E-Mail Removed) .com>,
Vijay <(E-Mail Removed)> wrote:

>xmlnssl="http://www.w3.org/1999/XSL/Format"


This should probably be xmlnssl="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
 
Reply With Quote
 
 
 
 
Vijay
Guest
Posts: n/a
 
      11-01-2005

Richard Tobin wrote:
> In article <(E-Mail Removed) .com>,
> Vijay <(E-Mail Removed)> wrote:
>
> >xmlnssl="http://www.w3.org/1999/XSL/Format"

>
> This should probably be xmlnssl="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

 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      11-01-2005


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 xmlnssl="http://www.w3.org/1999/XSL/Format"

where I assume you want

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


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
Vijay
Guest
Posts: n/a
 
      11-01-2005

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 xmlnssl="http://www.w3.org/1999/XSL/Format"
>
> where I assume you want
>
> <xsl:stylesheet xmlnssl="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

 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      11-01-2005


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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema huntingseasonson@gmail.com Perl Misc 5 11-29-2006 12:37 PM
Validation of XSD (XML Schema) against XSD Rushi XML 1 12-09-2005 08:12 AM
XML schema - Make xsd include another xsd stiank81 XML 4 06-26-2005 05:11 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
referencing another XSD file within an XSD file JavaDeveloper@nowhere.com XML 1 01-14-2004 05:22 PM



Advertisments