Skip to main content

 PSML

A complete reference of PageSeeder's markup language PSML

<cell>

Summary

Represents a single cell in a table.

It only appears inside a <row> element but can also inherit properties from <col> element.

Usage context

Element categorytable
PSML levelportable
Permitted content
Permitted parent<row>
HTML equivalent<td> or <th> 
OpenXML equivalent<w:tc>

Attributes

This element includes the following attributes

NameTypeRequiredDescription
alignalignmentnoHorizontal alignment of text within the cell
colspanxs:positiveIntegernoHow many columns the cell extends to
rolexs:string noCustom value that can be used for formatting
rowspanxs:positiveInteger noHow many rows the cell extends to
valignalignmentnoVertical alignment of text within the cell (deprecated – use @role)
widthlengthnoWidth of the cell in pixels or percent (deprecated – use <col>/@width)

@align

Horizontal alignment of the text within the cell.

Possible values are:

  • center
  • justify
  • left
  • right

@colspan

A natural integer to indicate how many columns the cell extends to.

The default value is 1, meaning that the cell only extends to the current column. A value greater than the number of available columns is not an error in PageSeeder, but it is likely to cause problems when formatted.

When a cell extends beyond its current column, it only inherits the properties of the leftmost column it belongs to.

@role

A custom value to provide semantics for the cell. This can be used for formatting.

@rowspan

A natural integer to indicate how many rows the cell extends to.

The default value is 1, meaning that the cell only extends to the current row. A value greater than the number of available rows is not an error in PageSeeder, but it is likely to cause problems when formatted.

When a cell extends beyond the current row, it only inherits the properties of the first row it belongs to. 

Cells in header rows that span non-header rows are NOT displayed correctly in PageSeeder and NOT supported in HTML, the following example is incorrect:
 

<table>
  <row  part="header">
    <cell rowspan="2">Drug</cell>
    <cell>Dose</cell>
  </row>
  <row>
    <cell>(ml)</cell>
  </row>
  ...
</table>

@valign

Vertical alignment of text within the cell.

As of PSML beta 7, this attribute is deprecated.

@width

Width of the cell in pixels or percent.

As of PSML beta 7, this attribute is deprecated.

Examples

Table with single cell 

Table with a single cell:

<table>
  <row>
    <cell>unicell</cell>
  </row>
</table>

Table with headers

Table with the first column and first row as headers:

<table>
  <col part="header"/>  
  <row part="header">
    <cell>Name</cell>
    <cell>Score</cell>
  </row>
  <row>
    <cell>Alice</cell>
    <cell>17</cell>
  </row>
  <row>
    <cell>Bob</cell>
    <cell>19</cell>
  </row>
</table>

This would be generally be represented in HTML as:

<table>
   <thead>
     <tr>
       <th>Name</th>
       <th>Score</th>
     </tr>
   </thead>
   <tbody>
     <tr>
       <th>Alice</th>
       <td>17</td>
     </tr>
     <tr>
       <th>Bob</th>
       <td>19</td>
     </tr>
   </tbody>
 </table>

Schema

XML Schema

<xs:element name="cell" type="cell-style">

  <xs:complexType>
    <xs:attribute name="role" type="role"/>

    <xs:attribute name="align">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="left" />
          <xs:enumeration value="center" />
          <xs:enumeration value="right" />
          <xs:enumeration value="justify" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>

    <xs:attribute name="valign">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="top" />
          <xs:enumeration value="middle" />
          <xs:enumeration value="bottom" />
          <xs:enumeration value="baseline" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
 
    <xs:attribute name="width">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:pattern value="[0-9\.]+(px|%)?"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>

    <xs:attribute name="colspan" type="xs:positiveInteger"/>

    <xs:attribute name="rowspan" type="xs:positiveInteger"/>
  </xs:complexType>
</xs:element>

Relax Schema

element cell {
   attribute role { role }?,
   attribute colspan { xs:positiveInteger }?,
   attribute rowspan { xs:positiveInteger }?,
   attribute align { "center" | "justify"
                     | "left" | "right"}?,
   attribute valign { "top" | "middle"
                     | "bottom" | "baseline"}?,
   attribute width { text {pattern: "[0-9\.]+(px|%)?" } }?,
   (character-style-group | list | nlist | para
             | block | blockxref | image | preformat)*
}

Compatibility

This element was introduced in the first draft of PSML and is well-supported from PageSeeder 5.1.

Created on , last edited on