Using an XML Schema in a Stylesheet

Now that we’ve covered how schemas work, we’ll take a look at how to use them in XSLT. The <xsl:import-schema> element lets us import an XML Schema into our stylesheet directly. In addition to <xsl:import-schema>, an XML document can reference a schema with the xsi:noNamespaceSchemaLocation or xsi:schemaLocation attributes. If our stylesheet is set up correctly, the XSLT processor can use the referenced schema to validate data.

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.