Your last post clarifies a bit what you're doing wrong.
At 02:18 PM 8/9/01, you wrote:
> Thank you very much for your reply. I have a few questions as to your
>response. You said that part of my problem may have been due to problems
>with the *.xsd file. However, both my *.xsd file (which I myself wrote) as
>well as the *.xml file based on it were validated by XML Spy, and
>considered by the program to be valid. When you said that the problem might
>have resulted from there being no encasing tag, does that apply only to the
>XML file? I am currently trying to create a *.xsl file, not *.xml. Could
>you possibly explain a little bit further on what needs to be done?
The XSLT stylesheet (*.xsl) happens to be in XML syntax, but it won't be
valid to your schema, it does not need to declare the schema, and you
shouldn't try to validate it. The best way to "validate" a stylesheet is to
run it and test whether it transforms your input as expected.
> I do
>not completely understand what the creation of the *.xsl file has to do
>with the *.xml file. Do the two have to be linked?
No, they don't: if you run the transformation in batch mode (for example,
within XML Spy) they can be associated through other means than a link in
the XML. It is not uncommon to place a processing instruction (e.g.
<?xml-stylesheet type="text/xsl" href="mystyle.xsl"?>) in your XML file so
that a browser, when it opens the XML, can find the stylesheet on its own:
but it's not mandatory and your process might not use it.
> I thought that only the
>schema had to be linked to the XSL file, not the XML.
Nope, you have it backwards. What are you using as a how-to guide, anyway?
Basically the schema is itself analogous to a stylesheet: they are both
examples of "processing specifications". (Accordingly, some people are now
even using XSLT stylesheets to validate, instead of or in addition to
schemas.) As in:
XML + schema => output (error messages/warnings OR "good to go")
XML + stylesheet => output (XML, HTML, whatever)
So stylesheet processing and schema validation are separate processes, and
there's no direct relation between stylesheet (XSL) and schema. As separate
processes, they can be run separately or in parallel. More commonly, they
are chained: first you validate the document with the schema, just to see
if it's "correct"; then you process it with the stylesheet. It's like a QA
test on the gizmo to see if it will fit into the customer's blivit before
you mail it out. That way you don't get gizmos sent back with letters of
complaint: "this doesn't fit my blivit" (i.e. this XML doesn't work using
the stylesheet you gave me). You could "validate" it as easily (i.e. check
to confirm it works) by just running the stylesheet on it. But
schema-validation is usually better because it is more general-purpose.
>In the code below, would this tagging in the *.xml file be
>considered "encasing"? I tried it, but it still does not work...perhaps I
>misinterpeted your instructions.
><?xml version="1.0" encoding="UTF-8"?>
I think the "encasing" thing is a red herring here (that was Gavin's
problem not yours). It looks like you are on the right track here. If this
doesn't validate, it's because your schema doesn't describe this document.
We would need to see the declarations in the schema to see what was wrong.
(Note that the stylesheet has nothing to do with any of this and you could
remove that xml-stylesheet instruction without any effect on the schema
(PS: Gavin, if you want to sound like you know Greek, try saying "schemata" :-)
Wendell Piez mailto:[log in to unmask]
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
Mulberry Technologies: A Consultancy Specializing in SGML and XML