-1

OK. So I am still learning the ins and outs of XSLT and associating schemas. In my company we use XSLT in a very specific way, to transform XML metadata from one schema to another. (i.e. Dublin Core to PBCore, our house standard metadata to METS, etc.) I have a plain XML file with our standard metadata tags. I transform it using an XSLT that has these declarations:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
    <reVTMD xmlns="http://nwtssite.nwts.nara/schema/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="https://www.archives.gov/preservation/products/reVTMD.xsd"
        recordCreation="2016-03-24T18:13:51.0Z" profile="profile1" 
version="version1">

The output XML includes this:

<?xml version="1.0" encoding="UTF-8"?>
<reVTMD xmlns="http://nwtssite.nwts.nara/schema/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="https://www.archives.gov/preservation/products/reVTMD.xsd"
    recordCreation="2016-03-24T18:13:51.0Z"
    profile="profile1"
    version="version1">

at the top of the document. But I still get a "There is no schema or DTD associated with the document." in Oxygen when I try to validate the document against the reVTMD schema. What am I doing wrong?

  • 1
    Duplicate of [**How to link XML to XSD using schemaLocation or noNamespaceSchemaLocation**](https://stackoverflow.com/questions/35411871/how-to-link-xml-to-xsd-using-schemalocation-or-nonamespaceschemalocation). – kjhughes Feb 22 '18 at 20:56

1 Answers1

0

The xsi:schemaLocation attribute as its value needs a list of pairs associating a namespace with a schema location so with the input being in the namespace http://nwtssite.nwts.nara/schema/ and the schema being in the location https://www.archives.gov/preservation/products/reVTMD.xsd you need

xsi:schemaLocation="http://nwtssite.nwts.nara/schema/ https://www.archives.gov/preservation/products/reVTMD.xsd"
Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
  • Thanks. I tried this but when I use this I have all sorts of other errors coming up. I am beginning to think the problem is with this particular schema itself. It doesn't appear that anyone is developing it and no one uses it much anymore. The namespace doesn't appear valid anymore either. – Kelly J. Applegate Feb 23 '18 at 14:35
  • The way you tried was for sure wrong. As for all sorts of errors, if you learn that stuff and need help then start small, with simple examples, and gradually progress to more complex one. In general if you use a schema for a certain XML format inside of an XSLT stylesheet an XML editor or IDE might indeed raise error that having nothing to do with the validity of the XML itself but are rather caused by the mix of XSLT elements and result elements use in a stylesheet. So if you want to learn schemas I would suggest to start with pure XML and XSD and not to throw both of them into XSLT. – Martin Honnen Feb 23 '18 at 14:44
  • Unfortunately I stepped into a role at a job where these XSLTs were created a long time ago, and no one in the company has any clue about how they work or how to build them. I would love to start small and build from there, but that is not an option for me right now. – Kelly J. Applegate Feb 23 '18 at 14:49