What will be the xsd pattern for below xml having condition:
<?xml version="1.0" encoding="UTF-8"?>
<Tree>
<fruits>
<apple type="red">
</apple>
<apple type="red">
</apple>
<apple type="red">
</apple>
</fruits>
</Tree>
Validation requirement - validate xml only if type="green" occurs at least one time in xml. Above given xml should not pass validation as no element have type="green"
I have used below in my xsd.
<xs:simpleType name="type">
<xs:restriction base="xs:string">
<xs:pattern value="[red|green]"/>
</xs:restriction>
</xs:simpleType>