Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
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:

<xsl:import-schema>
   <xs:schema>
      <xs:simpleType name="year_maxim">		 	 	
         <xs:restriction base="xs:positiveInteger">
            <xs:minExclusive value="1990" />
            <xs:maxExclusive value="2010" />
         </xs:restriction>
      </xs:simpleType>
   </xs:schema>
</xsl:import-schema>
Leonard Anghel
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap