RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Home » Tip Bank » XML » XSLT
Language: XML
Expertise: Advanced
Jun 5, 2007

Import an XML Schema into a Stylesheet Using XSLT 2.0

This tip shows you how to import an XML schema in your XSL pages, using XSLT 2.0. For example, if your XML schema is named schema.xsd and it is stored in the same directory with your stylesheet, then you can import it like this:

<xsl:import-schema schema-location="schema.xsd"/>
If you want, you can define "rules" directly into the stylesheets by using the xs:schema element. In this case, you must skip the schema-location attribute. For example:

      <xs:simpleType name="year_maxim">		 	 	
         <xs:restriction base="xs:positiveInteger">
            <xs:minExclusive value="1990" />
            <xs:maxExclusive value="2010" />
Leonard Anghel
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date