clearing/clearing-parent/backend-api/src/main/resources/meta/xsl/report.xsl

151 lines
6.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">
<xsl:output version="1.0" method="html" indent="no" encoding="UTF-8"/>
<xsl:variable name="data" select="document('..\dictionaries.xml')/meta"/>
<xsl:variable name="metaxsd" select="document('..\meta.xsd')/xs:schema"/>
<xsl:variable name="meta" select="document('..\meta.xml')/meta"/>
<xsl:template match="/">
<html><xsl:apply-templates select="*"/></html>
</xsl:template>
<xsl:template match="meta">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Web</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<style type="text/css">
table.sample {
border-width: 1px 1px 1px 1px;
border-spacing: 2px;
border-style: outset outset outset outset;
border-color: gray gray gray gray;
border-collapse: collapse;
background-color: white;
}
table.sample th {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
-moz-border-radius: 0px 0px 0px 0px;
}
table.sample td {
border-width: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
border-style: inset inset inset inset;
border-color: gray gray gray gray;
background-color: white;
}
</style>
</head>
Version: <xsl:value-of select="@version"/>
<xsl:apply-templates select="reports"/>
<!--xsl:apply-templates select="enums"/-->
</xsl:template>
<xsl:template match="objects">
</xsl:template>
<xsl:template match="reports">
<a name="reports"/>
<h2>Общее описание отчетов</h2>
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:annotation/xs:documentation/."/></div>
<xsl:apply-templates select="*" mode="reports"/>
</xsl:template>
<xsl:template match="enums"><xsl:apply-templates select="*" mode="enums"/></xsl:template>
<xsl:template match="views"></xsl:template>
<xsl:template match="types"></xsl:template>
<xsl:template match="*" mode="reports">
<xsl:variable name="reportNum"><xsl:value-of select="position()"/></xsl:variable>
<xsl:variable name="reportName"><xsl:value-of select="name()"/></xsl:variable>
<a name="reports.{$reportName}"/>
<h2>1.<xsl:value-of select="$reportNum"/>. <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h2>
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:complexType/xs:sequence/xs:element[@name=$reportName]/xs:annotation/xs:documentation/."/></div>
<br/>
<xsl:for-each select="@*">
<xsl:variable name="reportField"><xsl:value-of select="name()"/></xsl:variable>
<div style="white-space: pre-wrap;"><xsl:value-of select="position()"/>. <xsl:value-of select="name()"/>=<xsl:value-of select="."/>
<xsl:if test="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:complexType/xs:sequence/xs:element[@name=$reportName]/xs:complexType/xs:attribute[@name=$reportField]/xs:annotation/xs:documentation/."> - <xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:complexType/xs:sequence/xs:element[@name=$reportName]/xs:complexType/xs:attribute[@name=$reportField]/xs:annotation/xs:documentation/."/>
</xsl:if>
</div>
</xsl:for-each>
<a name="reports.{$reportName}.fields"/>
<h3>1.<xsl:value-of select="$reportNum"/>.2. Поля объекта</h3>
<table class="sample" id="{name()}" width="100%" border="0">
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="45%">Обработка</td></tr>
<xsl:for-each select="rows/@*">
<xsl:variable name="attributeName"><xsl:value-of select="name()"/></xsl:variable>
<tr> <td style="vertical-align: top;"><xsl:value-of select="position()"/></td>
<td style="vertical-align: top;">
<a name="reports.{$reportName}.fields.{name()}"/><xsl:value-of select="name()"/>
</td>
<td style="vertical-align: top;">
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='reports']/xs:complexType/xs:sequence/xs:element[@name=$reportName]/xs:complexType/xs:sequence/xs:element[@name='rows']/xs:complexType/xs:attribute[@name=$attributeName]/xs:annotation/xs:documentation/."/></div>
</td>
</tr>
</xsl:for-each>
</table>
<div>Пример:</div>
<div><textarea autocomplete="on" cols="100" rows="8"><xsl:copy-of select="."/></textarea></div>
</xsl:template>
<xsl:template match="*" mode="enums">
<a name="enums.{name()}"/>
<h3>2.<xsl:value-of select="position()"/>. <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h3>
<table class="sample" id="{name()}" width="100%" border="0">
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="45%">Описание</td><td width="20%">Наименование</td><td width="20%">Тип</td></tr>
<xsl:apply-templates select="*" mode="field-enums"/>
</table>
</xsl:template>
<xsl:template match="*" mode="field-enums">
<tr><td><xsl:value-of select="position()"/></td>
<td><xsl:value-of select="name()"/></td>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name()='type'">
<td>
<xsl:value-of select="name(/meta/types/*[@id=current()])"/>
<xsl:if test="../@length">(<xsl:value-of select="../@length"/>)</xsl:if>
</td>
</xsl:when>
<xsl:when test="name()='searchable'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='sortable'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='visible'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='required'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='hidden'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='ignored'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='cacheable'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='name'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='shortname'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='link'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='field'"><td><xsl:value-of select="."/></td></xsl:when>
<xsl:when test="name()='dbfield'"><td><xsl:value-of select="."/></td></xsl:when>
</xsl:choose>
</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>