3
votes

Here is a really stupid question, but I don't know the answer to it so try not to giggle too much. I am learning how to create an xsd file. I have created one following various howtos online. The thing I don't know how to do (and is never mentioned in the tutorials) is how do I reference this xsd in other xml and xslt files? The xsd isn't hosted on a website and I don't want it to be since it is only for internal use. So my question is, how do I accomplish this?

1
Not a stupid question, but it's been asked before: How to reference a local xml schema file correctly?.kjhughes
@kjhughes Thanks for the reference.user5013

1 Answers

1
votes

There are two way to solve this problem...

first one:

<xs:import namespace="http://www.example.org/Something" schemaLocation="path/of/your/xsd/file.xsd" />

second one:

Build a catalog file to identify namespace to the resource .. see here

(e.g. from http://mojo.codehaus.org/xml-maven-plugin/examples/catalog.html)

  <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <public publicId="http://www.w3.org/1999/XSL/Transform" uri="./schema-for-xslt20.xsd"/>
    <system systemId="http://www.example.com/sample.dtd" uri="./sample.dtd"/>
  </catalog>