xslt-examples/relpipe-out-xhtml.xsl
branchv_0
changeset 29 509cac0cf411
parent 27 796ff16f32fc
equal deleted inserted replaced
28:a93583fdc8e4 29:509cac0cf411
    30 		encoding="UTF-8"
    30 		encoding="UTF-8"
    31 		doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    31 		doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    32 		doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>
    32 		doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>
    33 
    33 
    34 	<xsl:param name="title" select="'Relational pipes XHTML output'"/>
    34 	<xsl:param name="title" select="'Relational pipes XHTML output'"/>
       
    35 	<xsl:param name="description">This is output of <code>relpipe-out-xml</code> converted to XHTML web page.</xsl:param>
       
    36 	<xsl:param name="recordCountPrefix">Record count: </xsl:param>
       
    37 	<xsl:param name="recordCountSuffix"></xsl:param>
       
    38 	<xsl:param name="relationNamePrefix"></xsl:param>
       
    39 	<xsl:param name="relationNameSuffix"></xsl:param>
       
    40 	<xsl:param name="cssAppendix"></xsl:param>
    35 
    41 
    36 
    42 
    37 	<!--
    43 	<!--
    38 		TODO:
    44 		TODO:
    39 			Parameters:
    45 			Parameters:
    40 				title / h1
       
    41 				introduction and footer for whole report
       
    42 				introduction and footer for every relation
       
    43 				custom CSS + optionaly remove default CSS
       
    44 				custom JavaScript
    46 				custom JavaScript
    45 				whether to display or hide types in table headers
       
    46 				whether to insert CSS classes for data types in each <td/>
    47 				whether to insert CSS classes for data types in each <td/>
    47 				custom pre regex (see below)
    48 				custom pre regex (see below)
    48 				metadata relation name (will be hidden and we will get texts or custom titles for particular relations)
    49 				metadata relation name (will be hidden and we will get texts or custom titles for particular relations)
    49 
    50 
    50 			CSS:
    51 			CSS:
    51 				clean-up, better style
       
    52 				attribute name
       
    53 				attribute type
       
    54 				relation name
       
    55 				table class for each relation (if [a-zA-Z0-9]+)
    52 				table class for each relation (if [a-zA-Z0-9]+)
    56 	-->
    53 	-->
    57 
    54 
    58 	<xsl:template match="/">
    55 	<xsl:template match="/">
    59 		<html>
    56 		<html>
    62 					<xsl:value-of select="$title"/>
    59 					<xsl:value-of select="$title"/>
    63 				</title>
    60 				</title>
    64 				<meta name="generator" content="Relational pipes: https://relational-pipes.globalcode.info/"/>
    61 				<meta name="generator" content="Relational pipes: https://relational-pipes.globalcode.info/"/>
    65 				<style type="text/css">
    62 				<style type="text/css">
    66 					body {
    63 					body {
    67 					font-family: sans;
    64 					font-family: "Latin Modern Sans", sans;
    68 					background-color: #eee;
    65 					background-color: #efefef;
    69 					color: black;
    66 					color: black;
    70 					padding-left: 20px;
    67 					padding-left: 20px;
    71 					}
    68 					}
    72 					
    69 					
    73 					p {
    70 					p {
    74 					max-width: 800px;
    71 					max-width: 1200px;
    75 					}
       
    76 					
       
    77 					h1,h2 {
       
    78 					max-width: 800px;
       
    79 					border-radius: 8px;
       
    80 					border: 1px solid #ddd;
       
    81 					background-color: #e8e8e8;
       
    82 					padding: 6px;
       
    83 					text-shadow: 2px 2px 2px #aaa;
       
    84 					}
    72 					}
    85 					
    73 					
    86 					h1 {
    74 					h1 {
    87 					font-size: 150%
    75 					font-size: 160%;
       
    76 					font-weight: bolder;
    88 					}
    77 					}
       
    78 
    89 					h2 {
    79 					h2 {
    90 					font-size: 100%;
    80 					font-size: 130%;
    91 					font-weight: bold;
    81 					font-weight: bolder;
       
    82 					}
       
    83 					
       
    84 					code {
       
    85 					font-family: "Latin Modern Mono", "Dejavu Sans Mono", monospace;
    92 					}
    86 					}
    93 					
    87 					
    94 					pre,code {
    88 					pre,code {
    95 					color: #a00;
    89 					font-family: "Latin Modern Mono", "Dejavu Sans Mono", monospace;
    96 					}
    90 					}
    97 					
    91 					
    98 					table {
    92 					table {
    99 					border-collapse:collapse;
    93 					border-collapse:collapse;
   100 					box-shadow: 3px 3px 3px grey;
       
   101 					margin-top: 10px;
    94 					margin-top: 10px;
   102 					margin-bottom: 10px;
    95 					margin-bottom: 10px;
       
    96 					box-shadow: 3px 3px 2px 0px rgba(0,0,0,0.2);
   103 					}
    97 					}
   104 					td, th {
    98 					td, th {
   105 					border: 1px solid black;
    99 					border: 1px solid black;
   106 					padding-top: 4px;
   100 					padding-top: 4px;
   107 					padding-bottom: 4px;
   101 					padding-bottom: 4px;
   118 					}
   112 					}
   119 					tbody tr:hover {
   113 					tbody tr:hover {
   120 					background-color: silver;
   114 					background-color: silver;
   121 					color:black;
   115 					color:black;
   122 					}
   116 					}
   123 					
   117 					<xsl:value-of select="$cssAppendix"/>
   124 				</style>
   118 				</style>
   125 			</head>
   119 			</head>
   126 			<body>
   120 			<body>
   127 				<h1>
   121 				<h1>
   128 					<xsl:value-of select="$title"/>
   122 					<xsl:value-of select="$title"/>
   129 				</h1>
   123 				</h1>
   130 				
   124 				
   131 				<p>
   125 				<p class="description">
   132 					This is output of <code>relpipe-out-xml</code> converted to XHTML web page.
   126 					<xsl:copy-of select="$description"/>
   133 				</p>
   127 				</p>
   134 				
   128 				
   135 				<xsl:for-each select="/rp:relpipe/rp:relation">
   129 				<xsl:for-each select="/rp:relpipe/rp:relation">
   136 					<h2>
   130 					<h2>
       
   131 						<xsl:copy-of select="$relationNamePrefix"/>
   137 						<xsl:value-of select="rp:name"/>
   132 						<xsl:value-of select="rp:name"/>
       
   133 						<xsl:copy-of select="$relationNameSuffix"/>
   138 					</h2>
   134 					</h2>
   139 					
   135 					
   140 					<table>
   136 					<table>
   141 						<thead>
   137 						<thead>
   142 							<tr>
   138 							<tr>
   143 								<xsl:for-each select="rp:attributes-metadata/rp:attribute-metadata">
   139 								<xsl:for-each select="rp:attributes-metadata/rp:attribute-metadata">
   144 									<td>
   140 									<td>
   145 										<xsl:value-of select="@name"/>
   141 										<span class="attributeName">
   146 										<xsl:text> (</xsl:text>
   142 											<xsl:value-of select="@name"/>
   147 										<xsl:value-of select="@type"/>
   143 										</span>
   148 										<xsl:text>)</xsl:text>
   144 										<span class="attributeType">
       
   145 											<xsl:text> (</xsl:text>
       
   146 											<xsl:value-of select="@type"/>
       
   147 											<xsl:text>)</xsl:text>
       
   148 										</span>
   149 									</td>
   149 									</td>
   150 								</xsl:for-each>
   150 								</xsl:for-each>
   151 							</tr>
   151 							</tr>
   152 						</thead>
   152 						</thead>
   153 						<tbody>
   153 						<tbody>
   163 								</tr>
   163 								</tr>
   164 							</xsl:for-each>
   164 							</xsl:for-each>
   165 						</tbody>
   165 						</tbody>
   166 					</table>
   166 					</table>
   167 					
   167 					
   168 					<p>
   168 					<p class="recordCount">
   169 						Record count: <xsl:value-of select="count(rp:record)"/>
   169 						<xsl:copy-of select="$recordCountPrefix"/>
       
   170 						<span class="recordCount">
       
   171 							<xsl:value-of select="count(rp:record)"/>
       
   172 						</span>
       
   173 						<xsl:copy-of select="$recordCountSuffix"/>
   170 					</p>
   174 					</p>
   171 					
   175 					
   172 				</xsl:for-each>
   176 				</xsl:for-each>
   173 
   177 
   174 			</body>
   178 			</body>