All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xslt.base.preprocess.lib.normalize-cals.xsl Maven / Gradle / Ivy





Mode for normalizing CALS tables


This mode is used to normalize CALS tables. A table has a rectangular
structure with a certain number of rows and columns. In the simplest case,
each row has the same number of entries (equal to the number of columns
in the table). Two complications arise: first, cells can span columns or
rows, second, a cell can identify the column in which it appears, potentially
“skipping” earlier columns (cells cannot appear out of order, so there's
no possibility of that column being “back filled” by a later cell that
explicitly identifies the skipped column).

Another complication arises in the way default values for cell
properties like alignment and row or column separators are calculated.
See inherit-table-attributes.


These complications make processing tables quite complicated. The
result of processing a table in the m:cals-phase-1 mode
is a normalized table. In the normalized table, all of rows have one
child element for each column and all of the attributes associated with
an entry appear literally on the entry.

In the case where a cell spans across columns or rows, the normalized
table will have a ghost:overlapped element in the phantom cells.
In the case where a cell has skipped some columns, those columns will have
a ghost:empty element.

Processing a normalized table is a simple matter of processing
each row and cell.




  
    
    
    
  



  
  
    
    
      
    
  



  



  
    
      
      
	
	
      
    
  

  

  

  

  
    
  



  
  

  
  
  

  

  
    
      
	
	
	
      
      
	
	
	
      
      
	
	

	
      
      
	
      
    
  

  
    
      
	
	

	
      
      
	
	

	
      
      1
    
  



  
    
    
      
	
      
      
	
	  
	    
	    
	  
	
      
    
  

  
    
    
    
    
    

    
      
    

    
  

  
    
      
    
  

  

  
    
    
  

  
  

    
      
      
        

          
            
              
              
            
          
        
        

          
        
      
    
  



  
    
    
  



  
    
    
  



  





Calculates attribute values for table cells


In a CALS table, each entry can have a number of properties
(alignment, row and column separators, etc.). If these properties aren't
specified directly on the entry, then their default values are calculated
by a complex series of defaults.


A property can be specified in any of nine locations:



The entry.



The row.



The tgroup.



The table or informaltable.



The spanspec if this entry has
a spanname attribute.


The starting column of the span as identified by the
namest attribute on the spanspec
(if there is one, see previous.)



The starting column of the span identified directly by a
namest attribute on the entry.



The colspec for the column in which it occurs (either
naturally or as a result of a colname attribute).



Some application default.




This template performs those lookup operations and generates an
explicit attribute node for each inheritable property. In this way,
a normalized cell has all of the proper values specified directly.




entry

The table cell element, defaults to the current context node.


colnum

The column number in which this entry appears.


row

The row containing the cell, defaults to the parent of the entry.
This parameter exists independent of the entry because when the entry is
an empty column (for example, at the end of a short row), the entry will
be an integer and won't have a parent.






A sequence of attribute nodes, one for each property.




  
  
  

  

  
  
  

  
    
      
	
      
      
	
      
    
  

  

  
    

    
      
	
	  
	
	
	  
	    
	  
	
      
    

    
      
	
      
      
	
	
	  
	
      
    
  





Selects an element based on the presence of an attribute


Given a sequence of elements and an attribute name, this
function returns the first element in the list that has the
specified attribute.




elements

A sequence of zero or more elements.


attr

The name of the attribute to find.






An element or the empty sequence if no element has the specified
attribute.




  
  

  
    
      
    
    
      
    
    
      
    
  





Finds the colspec for the specified column
number.


Searches the colspec elements and returns the one
for the specified column.




tgroup

The tgroup element in which to search.


colnum

The column number.






The colspec or the empty sequence if there is no
specification for that column.




  
  
  
  



  
  
  

  
    
      
    
    
      
	
	  
	
	
	  
	
      
    
    
      
	
	  
	
	
	  
	
      
    
  





Finds the next available column position in a CALS table


This function returns the next available column position in a
CALS table, skipping over the columns that contains cells which hang
down into the current row.




overhang

A sequence of integer values giving the depth of “overhang” from
previous rows for
cells in each column of the table.


pos

The nominal next column. This generally one more than the
current column number.






The next available column in the row.




  
  

  
    
      
    
    
      
    
  





Returns the column number associated with a particuluar
colspec.


This function returns the column number of the specified
colspec.




colspec

The colspec element.






The column number associated with that colspec.




  

  
    
      
    
    
      
    
    
      
    
  





Returns the column number of the starting column of a
span


This function returns the column number of the starting column
of a span.




spanspec

The spanspec element.






The column number associated with the first column of the
span.




  

  





Returns the column number of the ending column of a
span


This function returns the column number of the ending column
of a span.




spanspec

The spanspec element.






The column number associated with the last column of the span.




  

  





Generates an HTML colgroup.


Generates an HTML colgroup for the CALS table.





cols

The number of columns in the table.






A sequence of one or more col elements.




  
  

  
    
    
      
        
      
      
        
        
      
    
  





Generates an HTML col.


Generates an HTML col for a
colgroup.
See generate-colgroup.





countcol

The number of the column.






A col element.




  
  
  1
  1

  
    
      
    
    
      
      
	
	  
            
          
          
            
          
        
      

      
	
	  
	    
	      
		
		  
		    
		  
		  
		    
		  
		
	      
	    

	    
	      
		
		  
		
	      
	      
	      
		
                  
		
              
            

	    
              
                
              
            

            
              
                
              
            
	  
	
	
          
            
            
            
            
              
                
                  
                
                
                  
                
              
            
           
        
      
    
  







© 2015 - 2024 Weber Informatics LLC | Privacy Policy