# /=====================================================================\ 
# |  LaTeXML-tabular.rnc                                                |
# | RelaxNG model for LaTeXML generated documents                       |
# |=====================================================================|
# | Part of LaTeXML:                                                    |
# |  Public domain software, produced as part of work done by the       |
# |  United States Government & not subject to copyright in the US.     |
# |=====================================================================|
# | Bruce Miller <bruce.miller@nist.gov>                        #_#     |
# | http://dlmf.nist.gov/LaTeXML/                              (o o)    |
# \=========================================================ooo==U==ooo=/

default namespace = "http://dlmf.nist.gov/LaTeXML"

## This module defines the basic tabular, or alignment, structure.
## It is roughly parallel to the HTML model.
Misc.class |= tabular

#======================================================================

tabular =
## An alignment structure corresponding to tabular  or various similar forms.
## The model is basically a copy of HTML4's table.
element tabular { tabular_attributes, tabular_model }

## Attributes for \elementref{tabular}.
tabular_attributes = 
  Common.attributes,
  Backgroundable.attributes,
  ID.attributes,

  ## which row's baseline aligns with the container's baseline.
  attribute vattach { "top" | "middle" | "bottom" }?,

  ## the desired width of the tabular.
  attribute width { Length.type }?,

  ## the spacing between rows
  attribute rowsep { Length.type}?,

  ## the spacing between columns
  attribute colsep { Length.type}?

## Content model for \elementref{tabular}.
tabular_model = (thead | tfoot | tbody | tr)*

#======================================================================

thead =
## A container for a set of rows that correspond to the header of the tabular.
element thead { thead_attributes, thead_model }

## Attributes for \elementref{thead}.
thead_attributes =
  Common.attributes,
  Backgroundable.attributes

## Content model for \elementref{thead}.
thead_model = tr*

#======================================================================

tfoot =
## A container for a set of rows that correspond to the footer of the tabular.
element tfoot { tfoot_attributes, tfoot_model }

## Attributes for \elementref{tfoot}.
tfoot_attributes =
  Common.attributes,
  Backgroundable.attributes

## Content model for \elementref{tfoot}.
tfoot_model = tr*

#======================================================================

tbody =
## A container for a set of rows corresponding to the body of the tabular.
element tbody { tbody_attributes, tbody_model }

## Attributes for \elementref{tbody}.
tbody_attributes =
  Common.attributes,
  Backgroundable.attributes

## Content model for \elementref{tbody}.
tbody_model = tr*

#======================================================================

tr =
## A row of a tabular.
element tr { tr_attributes, tr_model }

## Attributes for \elementref{tr}.
tr_attributes =
  Common.attributes,
  Backgroundable.attributes,
  ID.attributes

## Content model for \elementref{tr}.
tr_model = td*

#======================================================================

td =
## A cell in a row of a tabular.
element td { td_attributes, td_model }

## Attributes for \elementref{td}.
td_attributes = 

  Common.attributes,
  Backgroundable.attributes,
  ID.attributes,

  ## indicates how many columns this cell spans or covers.
  attribute colspan { xsd:nonNegativeInteger }?,

  ## indicates how many rows this cell spans or covers.
  attribute rowspan { xsd:nonNegativeInteger }?,

  ##  specifies the horizontal alignment of the content.
  ## The allowed values are open-ended to accomodate \texttt{char:.} type alignments.
  attribute align { "left" | "right" | "center" | "justify" | text }?,

  ## specifies the desired width for the column.
  attribute width { Length.type }?,

  ## how the cell contents aligns with the row's baseline.
  attribute vattach { "top" | "middle" | "bottom" }?,

  ## records a sequence of t or tt, r or rr, b or bb and l or ll
  ## for borders or doubled borders on any side of the cell.
  attribute border { text }?,

  ## whether this cell corresponds to a table row or column heading or both
  ## (whether in head or foot).
  attribute thead { "column" | "column row" | "row"}?

## Content model for \elementref{td}.
td_model =  Flow.model

#======================================================================