<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
  
  http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- $Id: fop-intermediate-format-ng-content.xsd 1537948 2013-11-01 14:34:18Z gadams $ -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
  targetNamespace="http://xmlgraphics.apache.org/fop/intermediate"
  xmlns:mf="http://xmlgraphics.apache.org/fop/intermediate">
  <xs:include schemaLocation="fop-intermediate-format-ng-datatypes.xsd"/>
  <xs:complexType name="contentType">
    <xs:choice maxOccurs="unbounded" minOccurs="0">
      <xs:element name="viewport">
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="mf:contentType">
              <xs:attribute name="transform" type="xs:string"/>
              <xs:attributeGroup ref="mf:sizeAtts"/>
              <xs:attribute name="clip-rect" type="mf:rectangleType"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="g">
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="mf:contentType">
              <xs:attribute name="transform" type="xs:string"/>
              <xs:attribute name="layer" type="xs:string"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="id">
        <xs:complexType>
          <xs:attribute name="name" use="required" type="xs:string"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="font">
        <xs:complexType>
          <xs:attribute name="family" type="xs:string"/>
          <xs:attribute name="style" type="mf:fontStyleType"/>
          <xs:attribute name="variant" type="mf:fontVariantType"/>
          <xs:attribute name="weight" type="mf:fontWeightType"/>
          <xs:attribute name="stretch" type="mf:fontStretchType"/>
          <xs:attribute name="size" type="mf:lengthType"/>
          <xs:attribute name="color" type="mf:colorType"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="text">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:string">
              <xs:attribute name="x" use="required" type="mf:lengthType"/>
              <xs:attribute name="y" use="required" type="mf:lengthType"/>
              <xs:attribute name="letter-spacing" type="mf:lengthType"/>
              <xs:attribute name="word-spacing" type="mf:lengthType"/>
              <xs:attribute name="dx" type="mf:lengthListType"/>
              <xs:attribute name="dp" type="mf:dpListType"/>
              <xs:attribute name="hyphenated" type="xs:boolean"/>
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="clip-rect">
        <xs:complexType>
          <xs:attributeGroup ref="mf:rectAtts"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="rect">
        <xs:complexType>
          <xs:attributeGroup ref="mf:rectAtts"/>
          <xs:attributeGroup ref="mf:fillAtts"/>
          <xs:attributeGroup ref="mf:borderAtts"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="line">
        <xs:complexType>
          <xs:attribute name="x1" use="required" type="mf:lengthType"/>
          <xs:attribute name="y1" use="required" type="mf:lengthType"/>
          <xs:attribute name="x2" use="required" type="mf:lengthType"/>
          <xs:attribute name="y2" use="required" type="mf:lengthType"/>
          <xs:attribute name="color" use="required" type="mf:colorType"/>
          <xs:attribute name="stroke-width" use="required" type="mf:lengthType"/>
          <xs:attribute name="style" use="required" type="mf:ruleStyle"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="border-rect">
        <xs:complexType>
          <xs:attributeGroup ref="mf:rectAtts"/>
          <xs:attribute name="inner-background-color" type="mf:colorType"/>
          <xs:attributeGroup ref="mf:borderAtts"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="image">
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="xs:anyType">
              <!-- Either use element content with any namespace or xlink:href -->
              <xs:attributeGroup ref="mf:rectAtts"/>
              <xs:attributeGroup ref="mf:foreignAtts"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:complexType>
  <xs:attributeGroup name="sizeAtts">
    <xs:attribute name="width" type="mf:lengthType" use="required"/>
    <xs:attribute name="height" type="mf:lengthType" use="required"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="posAtts">
    <xs:attribute name="x" type="mf:lengthType" default="0"/>
    <xs:attribute name="y" type="mf:lengthType" default="0"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="rectAtts">
    <xs:attributeGroup ref="mf:posAtts"/>
    <xs:attributeGroup ref="mf:sizeAtts"/>
  </xs:attributeGroup>
   <xs:attributeGroup name="borderAtts">
    <xs:attribute name="left" type="mf:borderDef"/>
    <xs:attribute name="right" type="mf:borderDef"/>
    <xs:attribute name="top" type="mf:borderDef"/>
    <xs:attribute name="bottom" type="mf:borderDef"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="fillAtts">
    <xs:attribute name="fill" type="xs:string" default="none"/>
  </xs:attributeGroup>
  <!--xs:attributeGroup name="fillStrokeAtts">
    <xs:attribute name="fill" type="xs:string" default="none"/>
    <xs:attribute name="stroke" type="xs:string" default="none"/>
  </xs:attributeGroup-->
  <xs:attributeGroup name="foreignAtts">
    <xs:anyAttribute namespace="##other" processContents="lax"/>
  </xs:attributeGroup>
  <xs:attribute name="xmlSpace">
    <!--
    This is a copy of the definition of the xml:space attribute, from the schema for the XML 
    namespace. That schema can be found at http://www.w3.org/2001/xml.xsd.

    Ideally we would want to re-use that schema. However, we don’t want to refer to it using an 
    import statement is it causes too many connections to the W3C website. Neither can we store a 
    local copy and ship it with FOP as its license is the W3C Document License and so far we are not 
    allowed to redistribute files under such a license.
    See also https://issues.apache.org/jira/browse/LEGAL-111
    -->
    <xs:simpleType>
      <xs:restriction base="xs:NCName">
        <xs:enumeration value="default"/>
        <xs:enumeration value="preserve"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
</xs:schema>
