<?xml version="1.0" encoding="UTF-8"?>
<!--
JBoss, Home of Professional Open Source
Copyright ${year}, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.


This is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.


This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.


You should have received a copy of the GNU Lesser General Public
License along with this software; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jboss.org/schema/richfaces/cdk/jstl/core"
    xmlns="http://jboss.org/schema/richfaces/cdk/jstl/core" elementFormDefault="qualified" attributeFormDefault="unqualified">

    <xs:annotation>
        <xs:documentation>
            Subset of JSTL 1.2 core library supported by RichFaces CDK.
        </xs:documentation>
    </xs:annotation>

    <xs:simpleType name="elStrictExpression">
        <xs:restriction base="xs:string">
            <xs:pattern value="#\{[^\}]+\}" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="literalExpression">
        <xs:restriction base="xs:string">
            <!-- TODO -->
            <xs:pattern value=".*" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="elMixedExpression">
        <xs:restriction base="xs:string">
            <xs:pattern value=".*#\{[^\}]+\}.*" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="elFreeformExpression">
        <xs:restriction base="xs:string" />
    </xs:simpleType>

    <xs:complexType name="arbitraryContent" mixed="true">
        <xs:choice>
            <xs:any minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="arbitraryConditionalContent">
        <xs:complexContent>
            <xs:extension base="arbitraryContent">
                <xs:attribute name="test" form="unqualified" use="required" type="elStrictExpression">
                    <xs:annotation>
                        <xs:documentation>
                            <p>The test condition that determines whether or not the body content should be processed.</p>
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:element name="if" type="arbitraryConditionalContent">
        <xs:annotation>
            <xs:documentation>
                <p>Simple conditional tag, which evalutes its body if the supplied condition is true
                    and optionally exposes a
                    Boolean scripting variable representing the evaluation of
                    this condition
                </p>
            </xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="choose">
        <xs:annotation>
            <xs:documentation>
                <p>
                    Simple conditional tag that establishes a context for mutually exclusive conditional
                    operations, marked by
                    <code><![CDATA[<c:when>]]></code>
                    and
                    <code><![CDATA[<c:otherwise>]]></code>
                    tags.
                </p>
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" name="when" type="arbitraryConditionalContent">
                    <xs:annotation>
                        <xs:documentation>
                            <p>
                                Subtag of
                                <code><![CDATA[<c:choose>]]></code>
                                that includes its body if its condition
                                evaluates to 'true'.
                            </p>
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element minOccurs="0" name="otherwise" type="arbitraryContent">
                    <xs:annotation>
                        <xs:documentation>
                            <p>
                                Subtag of
                                <code><![CDATA[<c:choose>]]></code>
                                that follows tags and runs only if
                                all of the prior conditions evaluated to 'false'.
                            </p>
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="forEach">
        <xs:annotation>
            <xs:documentation>
                <p>The basic iteration tag, accepting many different collection types and supporting subsetting
                    and other
                    functionality.
                </p>
                <p>
                    <span class="warning">Support for this tag is not currently implemented.</span>
                </p>
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="arbitraryContent">
                    <xs:attribute name="items" type="elStrictExpression">
                        <xs:annotation>
                            <xs:documentation>
                                <p>Collection of items to iterate over.</p>
                            </xs:documentation>
                        </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="var" type="literalExpression">
                        <xs:annotation>
                            <xs:documentation>
                                <p>Name of the exported scoped variable for the current item of the iteration.
                                    This scoped
                                    variable has nested visibility. Its type depends on the object
                                    of the underlying collection.
                                </p>
                            </xs:documentation>
                        </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="varStatus" type="literalExpression">
                        <xs:annotation>
                            <xs:documentation>
                                <p>Name of the exported scoped variable for the status of the iteration. Object exported is of
                                    type javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility.
                                </p>
                            </xs:documentation>
                        </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="begin" type="literalExpression">
                        <xs:annotation>
                            <xs:documentation>
                                <p>If items specified: Iteration begins at the item located at the specified index. First item
                                    of the collection has index 0. If items not specified: Iteration begins with index set at
                                    the value specified.
                                </p>
                            </xs:documentation>
                        </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="end" type="literalExpression">
                        <xs:annotation>
                            <xs:documentation>
                                <p>If items specified: Iteration ends at the item located at the specified index (inclusive). If
                                    items not specified: Iteration ends when index reaches the value specified.
                                </p>
                            </xs:documentation>
                        </xs:annotation>
                    </xs:attribute>
                    <xs:attribute name="step" type="literalExpression">
                        <xs:annotation>
                            <xs:documentation>
                                <p>Iteration will only process every step items of the collection, starting with the first one.
                                </p>
                            </xs:documentation>
                        </xs:annotation>
                    </xs:attribute>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>
</xs:schema>
