I have an XSD element defined as the following:
<xsd:simpleType name="string1500">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1500" />
</xsd:restriction>
</xsd:simpleType>
This element is referenced in another XSD in the following way:
<xsd:element minOccurs="0" name="Description" type="bons3:string1500" />
(bons3 references the same namespace in both XSDs.)
When a string of length 2000 characters is passed into the Description field in an XSLT, all 2000 characters are preserved even though the the restriction of 1500 characters was put in place. Am I setting the restriction wrong, or is there another way to ensure in the XSD that the maximum length of this field is 1500 characters?
Thanks.
XSLT and XSD are two different things. XSLT 1.0 doesn’t care about XSD, or any other XML schema language for that matter. XSLT 2.0 introduced an XSD aware extension, for which you have to find an appropriate XSLT processor, which may stop you from processing the XML; however, it will not auto-magically make it valid.