SPCEX-1.0.0.0 backend-api added document generation with xslt transformation
This commit is contained in:
parent
0f087c2f26
commit
e8c4088976
10 changed files with 28401 additions and 20 deletions
|
|
@ -129,34 +129,187 @@
|
|||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>xml-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<!--all doc generation: mvn clean xml:transform@ddl xml:transform@data xml:transform@db xml:transform@json xml:transform@core xml:transform@report xml:transform@web -->
|
||||
<execution>
|
||||
<!-- Generate DDL.sql from META file
|
||||
command: mvn xml:transform@ddl -->
|
||||
<id>ddl</id>
|
||||
<goals>
|
||||
<goal>transform</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>meta.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/ddl.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>ddl.sql</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Generate Data.sql from META and DATA file
|
||||
command: mvn xml:transform@data -->
|
||||
<id>data</id>
|
||||
<goals>
|
||||
<goal>transform</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>data.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/data.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>data.sql</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Generate db.html - description from META and dATA file
|
||||
command: mvn xml:transform@db -->
|
||||
<id>db</id>
|
||||
<goals>
|
||||
<goal>transform</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>meta.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/db.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>db.html</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Generate meta.json - description from META file
|
||||
command: mvn xml:transform@json -->
|
||||
<id>json</id>
|
||||
<goals>
|
||||
<goal>transform</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>meta.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/json.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>meta.json</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Generate core.html - description from META* files
|
||||
command: mvn xml:transform@core -->
|
||||
<id>core</id>
|
||||
<goals>
|
||||
<goal>transform</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>meta.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/core.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>core.html</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Generate report.html - report description from META* files
|
||||
command: mvn xml:transform@report -->
|
||||
<id>report</id>
|
||||
<goals>
|
||||
<goal>transform</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>meta.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/report.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>report.html</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Generate web.html - description from META* files
|
||||
command: mvn xml:transform@web -->
|
||||
<id>web</id>
|
||||
<goals>
|
||||
<goal>transform</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<includes>
|
||||
<include>meta.xml</include>
|
||||
</includes>
|
||||
<stylesheet>src/main/resources/meta/xsl/web.xsl</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>web.html</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<transformationSets>
|
||||
<transformationSet>
|
||||
<dir>src/main/resources/meta</dir>
|
||||
<excludes>
|
||||
<exclude>meta.server.xslt</exclude>
|
||||
</excludes>
|
||||
<stylesheet>src/main/resources/meta/meta.server.xslt</stylesheet>
|
||||
<fileMappers>
|
||||
<fileMapper
|
||||
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
|
||||
<targetExtension>.json</targetExtension>
|
||||
</fileMapper>
|
||||
</fileMappers>
|
||||
</transformationSet>
|
||||
</transformationSets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
|
|
|
|||
|
|
@ -261,9 +261,9 @@
|
|||
</userCls>
|
||||
<userRoleSession name="Набор ролей" destination="user-role-sessions" class="ru.clearing.classes.statics.data.user.UserRoleSession" table="user_role_session">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<userId type="1" name="Идентификатор пользователя" shortname="Пользователь" searchable="true" sortable="true" visible="true" link="userCls"/>
|
||||
<userId type="1" name="Идентификатор пользователя" shortname="Пользователь" searchable="true" sortable="true" visible="true" link="userCls" linkCode="name"/>
|
||||
<userRole type="12" name="Идентификатор роли" shortname="Роль" searchable="true" sortable="true" visible="true" link="userRole"/>
|
||||
<companyId type="1" name="Идентификатор компании" shortname="Компания" searchable="true" sortable="true" visible="true" link="company"/>
|
||||
<companyId type="1" name="Идентификатор компании" shortname="Компания" searchable="true" sortable="true" visible="true" link="company" linkCode="shortName"/>
|
||||
<status type="12" name="Статус" shortname="Статус" searchable="true" sortable="true" link="workflowStatus"/>
|
||||
</userRoleSession>
|
||||
<userSettings name="Настройки пользователя" destination="utilities/user-settings" class="ru.clearing.classes.statics.data.user.UserSettings" table="user_settings">
|
||||
|
|
|
|||
26952
clearing-parent/backend-api/src/main/resources/meta/meta.xsd
Normal file
26952
clearing-parent/backend-api/src/main/resources/meta/meta.xsd
Normal file
File diff suppressed because it is too large
Load diff
193
clearing-parent/backend-api/src/main/resources/meta/xsl/core.xsl
Normal file
193
clearing-parent/backend-api/src/main/resources/meta/xsl/core.xsl
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
<?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('..\data.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="objects"/>
|
||||
<xsl:apply-templates select="enums"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
|
||||
<xsl:template match="objects">
|
||||
<a name="objects"/>
|
||||
<h2>Общее описание бизнес-объектов</h2>
|
||||
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:annotation/xs:documentation/."/></div>
|
||||
<xsl:apply-templates select="*" mode="objects"/>
|
||||
</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="objects">
|
||||
<xsl:variable name="objectNum"><xsl:value-of select="position()"/></xsl:variable>
|
||||
<xsl:variable name="objectName"><xsl:value-of select="name()"/></xsl:variable>
|
||||
<a name="objects.{$objectName}"/>
|
||||
<h2>1.<xsl:value-of select="$objectNum"/>. <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='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:annotation/xs:documentation/."/></div>
|
||||
<br/>
|
||||
<a name="objects.{$objectName}.actions"/>
|
||||
<xsl:if test="actions">
|
||||
<h3>1.<xsl:value-of select="$objectNum"/>.1. Обработка методов</h3>
|
||||
</xsl:if>
|
||||
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name='actions']/xs:annotation/xs:documentation/."/></div>
|
||||
<xsl:for-each select="actions/*">
|
||||
<xsl:variable name="methodName"><xsl:value-of select="name()"/></xsl:variable>
|
||||
<a name="objects.{$objectName}.actions.{$methodName}"/>
|
||||
<h4>1.<xsl:value-of select="$objectNum"/>.1.<xsl:value-of select="position()"/>. <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h4>
|
||||
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name='actions']/xs:complexType/xs:sequence/xs:element[@name=$methodName]/xs:annotation/xs:documentation/."/></div>
|
||||
<br/>
|
||||
<table class="sample" id="{$objectName}{name()}" width="100%" border="0">
|
||||
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="10%">Тип</td><td width="10%">Обяз.</td><td width="45%">Наименование</td></tr>
|
||||
<xsl:for-each select="*">
|
||||
<xsl:variable name="methodField"><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="objects.{$objectName}.actions.{$methodName}.{name()}"/><xsl:value-of select="name()"/></td>
|
||||
<td style="vertical-align: top;">
|
||||
<xsl:if test="@type">
|
||||
<xsl:variable name="fieldType"><xsl:value-of select="@type"/></xsl:variable>
|
||||
<xsl:value-of select="$meta/types/*[@id=$fieldType]/@type"/>
|
||||
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if>
|
||||
</xsl:if>
|
||||
|
||||
</td>
|
||||
<td style="vertical-align: top;">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@required">O</xsl:when>
|
||||
<xsl:when test="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name='actions']/xs:complexType/xs:sequence/xs:element[@name=$methodName]/xs:complexType/xs:sequence/xs:element[@name=$methodField]/xs:annotation/xs:documentation/.">
|
||||
<div style="white-space: pre-wrap;"><xsl:copy-of select="$metaxsd/xs:element/xs:complexType/xs:sequence/xs:element[@name='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name='actions']/xs:complexType/xs:sequence/xs:element[@name=$methodName]/xs:complexType/xs:sequence/xs:element[@name=$methodField]/xs:annotation/xs:documentation/."/></div>
|
||||
</xsl:when>
|
||||
<xsl:otherwise></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
<td style="vertical-align: top;">
|
||||
<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if><br/>
|
||||
<xsl:if test="@link"><br/>Ссылается на объект: <xsl:value-of select="@link"/></xsl:if>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</xsl:for-each>
|
||||
<a name="objects.{$objectName}.fields"/>
|
||||
<h3>1.<xsl:value-of select="$objectNum"/>.2. Поля объекта</h3>
|
||||
<table class="sample" id="{name()}" width="100%" border="0">
|
||||
<tr><td width="5%">#</td><td width="10%">Поле</td><td>Тип</td><td>Наименование</td><td width="45%">Обработка</td></tr>
|
||||
<xsl:for-each select="*[name()!='actions' and not(@extends)]">
|
||||
<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;">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@linkKeyCode"><a name="objects.{$objectName}.fields.{@linkCode}"/><xsl:value-of select="@linkCode"/></xsl:when>
|
||||
<xsl:otherwise><a name="objects.{$objectName}.fields.{name()}"/><xsl:value-of select="name()"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:variable name="fieldType"><xsl:value-of select="@type"/></xsl:variable>
|
||||
<xsl:value-of select="$meta/types/*[@id=$fieldType]/@type"/>
|
||||
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if>
|
||||
</td>
|
||||
<td style="vertical-align: top;">
|
||||
<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if>
|
||||
<br/>
|
||||
<xsl:if test="@link"><br/>Ссылается на объект: <xsl:value-of select="@link"/>
|
||||
<xsl:if test="@linkKeyCode"> Содержит значение <xsl:value-of select="@linkCode"/> объекта <xsl:value-of select="@link"/> связанного по полям <xsl:value-of select="name()"/>=<xsl:value-of select="@link"/>.<xsl:value-of select="@linkKeyCode"/><br/></xsl:if>
|
||||
<!--xsl:variable name="linkData"><xsl:value-of select="@link"/></xsl:variable>
|
||||
<xsl:for-each select="xalan:nodeset($data)/enums/*[name()=$linkData]">
|
||||
<br/><xsl:value-of select="@code"/>(<xsl:value-of select="@id"/>) - <i><xsl:value-of select="@name"/></i>
|
||||
</xsl:for-each-->
|
||||
</xsl:if>
|
||||
</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='objects']/xs:complexType/xs:sequence/xs:element[@name=$objectName]/xs:complexType/xs:sequence/xs:element[@name=$attributeName]/xs:annotation/xs:documentation/."/></div>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="*" mode="enums">
|
||||
<xsl:variable name="enumName"><xsl:value-of select="name()"/></xsl:variable>
|
||||
<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="20%">Наименование</td><td width="10%">Тип</td></tr>
|
||||
<xsl:apply-templates select="*" mode="field-enums"/>
|
||||
</table>
|
||||
<div>Значения:</div>
|
||||
<xsl:for-each select="xalan:nodeset($data)/enums/*[name()=$enumName]">
|
||||
<xsl:value-of select="@id"/>. <xsl:value-of select="@code"/> - <i><xsl:value-of select="@name"/></i><br/>
|
||||
</xsl:for-each>
|
||||
|
||||
</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()='name'"><td><xsl:value-of select="."/></td></xsl:when-->
|
||||
<xsl:when test="name()='shortname'"><td><xsl:value-of select="."/></td></xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
163
clearing-parent/backend-api/src/main/resources/meta/xsl/data.xsl
Normal file
163
clearing-parent/backend-api/src/main/resources/meta/xsl/data.xsl
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">
|
||||
|
||||
<xsl:output version="1.0" method="text" indent="yes" encoding="UTF-8"/>
|
||||
|
||||
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
|
||||
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
||||
<xsl:variable name="avoidletters">_0123456789</xsl:variable>
|
||||
<xsl:variable name="meta" select="document('..\meta.xml')/meta"/>
|
||||
|
||||
<xsl:template match="/"><xsl:apply-templates select="*"/></xsl:template>
|
||||
|
||||
<xsl:template match="meta">-- DB version: <xsl:value-of select="$meta/@version"/>
|
||||
-- DATA version: <xsl:value-of select="@version"/>
|
||||
<xsl:apply-templates select="*"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="enums">
|
||||
/* Dictionaries */
|
||||
<xsl:apply-templates select="*" mode="enums"/>
|
||||
|
||||
</xsl:template>
|
||||
<xsl:template match="objects">
|
||||
/* Business objects */
|
||||
<xsl:apply-templates select="*" mode="objects"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="type" mode="types">
|
||||
-- <xsl:value-of select="@id"/>. <xsl:value-of select="@code"/> : <xsl:value-of select="@type"/> - <xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="enums">
|
||||
<xsl:variable name="nodeName" select="name()"/>
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='concat(name(xalan:nodeset($meta)/enums/*[name()=$nodeName]),"Dictionary")'/></xsl:call-template></xsl:variable>
|
||||
INSERT INTO <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="@*" mode="tablename">
|
||||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>) values (<xsl:apply-templates select="@*" mode="values">
|
||||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>);
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
<xsl:variable name="nodeName" select="name()"/>
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name(xalan:nodeset($meta)/objects/*[name()=$nodeName])'/></xsl:call-template></xsl:variable>
|
||||
INSERT INTO <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="@*" mode="tablename">
|
||||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>) values (<xsl:apply-templates select="@*" mode="values">
|
||||
<xsl:with-param name="nodeName" select="$nodeName"/>
|
||||
</xsl:apply-templates>);
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*" mode="tablename">
|
||||
<xsl:param name="nodeName"/>
|
||||
<xsl:variable name="fieldName" select="name()"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="xalan:nodeset($meta)/*/*[name()=$nodeName]/*[name()=$fieldName]">
|
||||
<xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template>
|
||||
<!--xsl:value-of select="name()"/-->
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:if test="position() != last()">, </xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*" mode="values">
|
||||
<xsl:param name="nodeName"/>
|
||||
<xsl:variable name="fieldName" select="name()"/>
|
||||
<xsl:variable name="field" select="xalan:nodeset($meta)/*/*[name()=$nodeName]/*[name()=$fieldName]"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="xalan:nodeset($field)/@type='2'">'<xsl:value-of select="."/>'</xsl:when>
|
||||
<xsl:when test="xalan:nodeset($field)/@type='12'">'<xsl:value-of select="."/>'</xsl:when>
|
||||
<xsl:when test="xalan:nodeset($field)/@type='4'">'<xsl:value-of select="."/>'</xsl:when>
|
||||
<xsl:when test="xalan:nodeset($field)/@type='5'">'<xsl:value-of select="."/>'</xsl:when>
|
||||
<xsl:when test="xalan:nodeset($field)/@type='6'">'<xsl:value-of select="."/>'</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="position() != last()">, </xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name='convertDbStyle'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:variable name="added_">
|
||||
<xsl:call-template name='add_'>
|
||||
<xsl:with-param name='toconvert' select='$toconvert' />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name='convertcase'>
|
||||
<xsl:with-param name='toconvert' select='$added_' />
|
||||
<xsl:with-param name='conversion' select="'upper'" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name='convertcase'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:param name='conversion' />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test='$conversion="lower"'>
|
||||
<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test='$conversion="upper"'>
|
||||
<xsl:value-of select="translate($toconvert,$lcletters,$ucletters)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test='$conversion="proper"'>
|
||||
<xsl:call-template name='convertpropercase'>
|
||||
<xsl:with-param name='toconvert'>
|
||||
<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select='$toconvert' />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='convertpropercase'>
|
||||
<xsl:param name='toconvert' />
|
||||
|
||||
<xsl:if test="string-length($toconvert) > 0">
|
||||
<xsl:variable name='f' select='substring($toconvert, 1, 1)' />
|
||||
<xsl:variable name='s' select='substring($toconvert, 2)' />
|
||||
|
||||
<xsl:call-template name='convertcase'>
|
||||
<xsl:with-param name='toconvert' select='$f' />
|
||||
<xsl:with-param name='conversion'>upper</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($s,' ')">
|
||||
<xsl:value-of select='substring-before($s," ")'/>
|
||||
<xsl:call-template name='convertpropercase'>
|
||||
<xsl:with-param name='toconvert' select='substring-after($s," ")' />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select='$s'/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='add_'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:if test="string-length($toconvert) > 0">
|
||||
<xsl:variable name='f' select='substring($toconvert, 1, 1)' />
|
||||
<xsl:variable name='s' select='substring($toconvert, 2)' />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$f = translate($f, $lcletters,$ucletters)"><xsl:if test="translate($f, $avoidletters,'')">_</xsl:if><xsl:value-of select='$f'/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select='$f'/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="string-length($toconvert) > 1">
|
||||
<xsl:call-template name='add_'>
|
||||
<xsl:with-param name='toconvert' select='$s'/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
209
clearing-parent/backend-api/src/main/resources/meta/xsl/db.xsl
Normal file
209
clearing-parent/backend-api/src/main/resources/meta/xsl/db.xsl
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output version="1.0" method="html" indent="no" encoding="UTF-8"/>
|
||||
|
||||
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
|
||||
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
||||
<xsl:variable name="avoidletters">_0123456789</xsl:variable>
|
||||
|
||||
<xsl:variable name="meta" select="document('..\meta.xml')/meta"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<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="*"/></xsl:template>
|
||||
|
||||
<xsl:template match="meta">-- DB version: <xsl:value-of select="@version"/><xsl:apply-templates select="*"/></xsl:template>
|
||||
|
||||
<xsl:template match="enums">
|
||||
/* Dictionaries */
|
||||
<xsl:apply-templates select="*" mode="enums"/>
|
||||
|
||||
</xsl:template>
|
||||
<xsl:template match="objects">
|
||||
/* Business objects */
|
||||
<xsl:apply-templates select="*" mode="objects"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="views">
|
||||
/* views */
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="types">
|
||||
-- Data types
|
||||
<xsl:apply-templates select="*" mode="types"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="type" mode="types">
|
||||
-- <xsl:value-of select="@id"/>. <xsl:value-of select="name()"/> : <xsl:value-of select="@type"/> - <xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="enums">
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='concat(name(),"Dictionary")'/></xsl:call-template></xsl:variable>
|
||||
<h3><xsl:value-of select="position()"/>. <xsl:value-of select="@name"/> - <xsl:value-of select="$dbTableName"/>( <xsl:value-of select="name()"/>)</h3>
|
||||
<table class="sample" width="100%" border="0">
|
||||
<tr><td width="10%">№</td><td width="20%">Поле</td><td width="20%">Тип</td><td width="45%">Наименование</td></tr>
|
||||
<xsl:apply-templates select="*" mode="comment-enums"/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
|
||||
<h3><xsl:value-of select="position()"/>. <xsl:value-of select="@name"/> - <xsl:value-of select="$dbTableName"/>( <xsl:value-of select="name()"/>)</h3>
|
||||
|
||||
<table class="sample" width="100%" border="0">
|
||||
<tr><td width="10%">№</td><td width="20%">Поле</td><td width="20%">Тип</td><td width="45%">Наименование</td></tr>
|
||||
<xsl:apply-templates select="*" mode="comment-objects"/>
|
||||
</table>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="field" >
|
||||
<xsl:if test="position() != '1'">, </xsl:if>
|
||||
<xsl:variable name="tp" select="@type"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@dbfield"><xsl:value-of select="@dbfield"/></xsl:when>
|
||||
<xsl:otherwise><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:otherwise>
|
||||
</xsl:choose> <xsl:value-of select="/meta/types/*[@id=$tp]/@type"/>
|
||||
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if><xsl:if test="name()='id'"> PRIMARY KEY</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="comment-enums">
|
||||
<tr>
|
||||
<td width="5%"><xsl:value-of select="position()"/></td>
|
||||
<td width="10%"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></td>
|
||||
<td width="20%"><xsl:variable name="fieldType"><xsl:value-of select="@type"/></xsl:variable>
|
||||
<xsl:value-of select="$meta/types/*[@id=$fieldType]/@type"/>
|
||||
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if>
|
||||
</td>
|
||||
<td width="45%"><xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if></td></tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="comment-objects">
|
||||
<xsl:if test="name() != 'actions'">
|
||||
<tr>
|
||||
<td width="5%"><xsl:value-of select="position()"/></td>
|
||||
<td width="10%"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></td>
|
||||
<td width="20%"><xsl:variable name="fieldType"><xsl:value-of select="@type"/></xsl:variable>
|
||||
<xsl:value-of select="$meta/types/*[@id=$fieldType]/@type"/>
|
||||
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if>
|
||||
</td>
|
||||
<td width="45%"><xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if></td></tr>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='convertDbStyle'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:variable name="added_">
|
||||
<xsl:call-template name='add_'>
|
||||
<xsl:with-param name='toconvert' select='$toconvert' />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name='convertcase'>
|
||||
<xsl:with-param name='toconvert' select='$added_' />
|
||||
<xsl:with-param name='conversion' select="'upper'" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name='convertcase'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:param name='conversion' />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test='$conversion="lower"'>
|
||||
<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test='$conversion="upper"'>
|
||||
<xsl:value-of select="translate($toconvert,$lcletters,$ucletters)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test='$conversion="proper"'>
|
||||
<xsl:call-template name='convertpropercase'>
|
||||
<xsl:with-param name='toconvert'>
|
||||
<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select='$toconvert' />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='convertpropercase'>
|
||||
<xsl:param name='toconvert' />
|
||||
|
||||
<xsl:if test="string-length($toconvert) > 0">
|
||||
<xsl:variable name='f' select='substring($toconvert, 1, 1)' />
|
||||
<xsl:variable name='s' select='substring($toconvert, 2)' />
|
||||
|
||||
<xsl:call-template name='convertcase'>
|
||||
<xsl:with-param name='toconvert' select='$f' />
|
||||
<xsl:with-param name='conversion'>upper</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($s,' ')">
|
||||
<xsl:value-of select='substring-before($s," ")'/>
|
||||
<xsl:call-template name='convertpropercase'>
|
||||
<xsl:with-param name='toconvert' select='substring-after($s," ")' />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select='$s'/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='add_'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:if test="string-length($toconvert) > 0">
|
||||
<xsl:variable name='f' select='substring($toconvert, 1, 1)' />
|
||||
<xsl:variable name='s' select='substring($toconvert, 2)' />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$f = translate($f, $lcletters,$ucletters)"><xsl:if test="translate($f, $avoidletters,'')">_</xsl:if><xsl:value-of select='$f'/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select='$f'/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="string-length($toconvert) > 1">
|
||||
<xsl:call-template name='add_'>
|
||||
<xsl:with-param name='toconvert' select='$s'/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
191
clearing-parent/backend-api/src/main/resources/meta/xsl/ddl.xsl
Normal file
191
clearing-parent/backend-api/src/main/resources/meta/xsl/ddl.xsl
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output version="1.0" method="text" indent="no" encoding="UTF-8"/>
|
||||
|
||||
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
|
||||
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
||||
<xsl:variable name="avoidletters">_0123456789</xsl:variable>
|
||||
|
||||
<xsl:template match="/"><xsl:apply-templates select="*"/></xsl:template>
|
||||
|
||||
<xsl:template match="meta">-- DB version: <xsl:value-of select="@version"/><xsl:apply-templates select="*"/></xsl:template>
|
||||
|
||||
<xsl:template match="enums">
|
||||
/* Dictionaries */
|
||||
<xsl:apply-templates select="*" mode="enums"/>
|
||||
|
||||
</xsl:template>
|
||||
<xsl:template match="objects">
|
||||
/* Business objects */
|
||||
<xsl:apply-templates select="*" mode="objects"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="views">
|
||||
/* views */
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="types">
|
||||
-- Data types
|
||||
<xsl:apply-templates select="*" mode="types"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="type" mode="types">
|
||||
-- <xsl:value-of select="@id"/>. <xsl:value-of select="name()"/> : <xsl:value-of select="@type"/> - <xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="enums">
|
||||
-- <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/>
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='concat(name(),"Dictionary")'/></xsl:call-template></xsl:variable>
|
||||
CREATE TABLE IF NOT EXISTS <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="*" mode="field"/>);
|
||||
COMMENT ON TABLE <xsl:value-of select="$dbTableName"/> IS '<xsl:value-of select="@name"/>';
|
||||
<xsl:apply-templates select="*" mode="comment-enums"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
-- <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/>
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
|
||||
CREATE TABLE IF NOT EXISTS <xsl:value-of select="$dbTableName"/>(<xsl:apply-templates select="*[@name or @type]" mode="field"/>);
|
||||
COMMENT ON TABLE <xsl:value-of select="$dbTableName"/> IS '<xsl:value-of select="@name"/>';
|
||||
<xsl:apply-templates select="*[@name or @type]" mode="comment-objects"/>
|
||||
<xsl:if test="@logUpdates">
|
||||
|
||||
-- History log of <xsl:value-of select="name()"/> - <xsl:value-of select="@name"/>
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:variable>
|
||||
CREATE TABLE IF NOT EXISTS <xsl:value-of select="$dbTableName"/>_HISTORY(<xsl:value-of select="$dbTableName"/>_ID BIGINT NOT NULL, EVENT_TIME timestamp, EVENT_USER_ID BIGINT, <xsl:apply-templates select="*[@name or @type]" mode="field"/>);
|
||||
COMMENT ON TABLE <xsl:value-of select="$dbTableName"/>_HISTORY IS 'История изменений таблицы <xsl:value-of select="name()"/>';
|
||||
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.<xsl:value-of select="$dbTableName"/>_ID IS 'Идентификатор записи в таблице <xsl:value-of select="$dbTableName"/>';
|
||||
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.EVENT_TIME IS 'Дата и время изменения';
|
||||
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.EVENT_USER_ID IS 'Инициатор изменения';
|
||||
<xsl:apply-templates select="*[@name or @type]" mode="comment-history-objects"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="field" >
|
||||
<xsl:variable name="tp" select="@type"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@dbfield"><xsl:value-of select="@dbfield"/></xsl:when>
|
||||
<xsl:when test="@linkKeyCode"></xsl:when>
|
||||
<xsl:when test="@extends"></xsl:when>
|
||||
<xsl:otherwise><xsl:if test="position() != '1'">, </xsl:if><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@linkKeyCode"></xsl:when>
|
||||
<xsl:when test="@extends"></xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text> </xsl:text><xsl:value-of select="/meta/types/*[@id=$tp]/@type"/>
|
||||
<xsl:if test="@length">(<xsl:value-of select="@length"/>)</xsl:if><xsl:if test="name()='id'"> PRIMARY KEY</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="comment-enums">
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='concat(name(parent::*),"Dictionary")'/></xsl:call-template></xsl:variable>
|
||||
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>.<xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template> IS '<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if>';
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="comment-objects">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@linkKeyCode"></xsl:when>
|
||||
<xsl:when test="@extends"></xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name(parent::*)'/></xsl:call-template></xsl:variable>
|
||||
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>.<xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template></xsl:otherwise>
|
||||
</xsl:choose> IS '<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if>';
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="comment-history-objects"><!-- todo похож на comment-objects только именем таблицы различается попробовать объединить -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="@linkKeyCode"></xsl:when>
|
||||
<xsl:when test="@extends"></xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="dbTableName"><xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name(parent::*)'/></xsl:call-template></xsl:variable>
|
||||
COMMENT ON COLUMN <xsl:value-of select="$dbTableName"/>_HISTORY.<xsl:call-template name='convertDbStyle'><xsl:with-param name='toconvert' select='name()'/></xsl:call-template> IS '<xsl:if test="@name"><xsl:value-of select="@name"/></xsl:if> <xsl:if test="@link"> (linked to <xsl:value-of select="@link"/>)</xsl:if>';
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='convertDbStyle'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:variable name="added_">
|
||||
<xsl:call-template name='add_'>
|
||||
<xsl:with-param name='toconvert' select='$toconvert' />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name='convertcase'>
|
||||
<xsl:with-param name='toconvert' select='$added_' />
|
||||
<xsl:with-param name='conversion' select="'upper'" />
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name='convertcase'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:param name='conversion' />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test='$conversion="lower"'>
|
||||
<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test='$conversion="upper"'>
|
||||
<xsl:value-of select="translate($toconvert,$lcletters,$ucletters)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test='$conversion="proper"'>
|
||||
<xsl:call-template name='convertpropercase'>
|
||||
<xsl:with-param name='toconvert'>
|
||||
<xsl:value-of select="translate($toconvert,$ucletters,$lcletters)"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select='$toconvert' />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='convertpropercase'>
|
||||
<xsl:param name='toconvert' />
|
||||
|
||||
<xsl:if test="string-length($toconvert) > 0">
|
||||
<xsl:variable name='f' select='substring($toconvert, 1, 1)' />
|
||||
<xsl:variable name='s' select='substring($toconvert, 2)' />
|
||||
|
||||
<xsl:call-template name='convertcase'>
|
||||
<xsl:with-param name='toconvert' select='$f' />
|
||||
<xsl:with-param name='conversion'>upper</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($s,' ')">
|
||||
<xsl:value-of select='substring-before($s," ")'/>
|
||||
<xsl:call-template name='convertpropercase'>
|
||||
<xsl:with-param name='toconvert' select='substring-after($s," ")' />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select='$s'/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name='add_'>
|
||||
<xsl:param name='toconvert' />
|
||||
<xsl:if test="string-length($toconvert) > 0">
|
||||
<xsl:variable name='f' select='substring($toconvert, 1, 1)' />
|
||||
<xsl:variable name='s' select='substring($toconvert, 2)' />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$f = translate($f, $lcletters,$ucletters)"><xsl:if test="translate($f, $avoidletters,'')">_</xsl:if><xsl:value-of select='$f'/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select='$f'/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="string-length($toconvert) > 1">
|
||||
<xsl:call-template name='add_'>
|
||||
<xsl:with-param name='toconvert' select='$s'/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
197
clearing-parent/backend-api/src/main/resources/meta/xsl/json.xsl
Normal file
197
clearing-parent/backend-api/src/main/resources/meta/xsl/json.xsl
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output version="1.0" method="text" indent="no" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="*"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="meta">
|
||||
{
|
||||
"version": "<xsl:value-of select="@version"/>",
|
||||
<xsl:apply-templates select="*"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="enums">
|
||||
"enums": {
|
||||
<xsl:apply-templates select="*" mode="enums"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="objects">
|
||||
,"objects": {
|
||||
<xsl:apply-templates select="*" mode="objects"/>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="views">
|
||||
,"views": {
|
||||
<!--xsl:apply-templates select="*" mode="views"/-->
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="reports"></xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="types">
|
||||
,"types": [
|
||||
<xsl:apply-templates select="*" mode="types"/>
|
||||
]
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="types">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{
|
||||
"code": "<xsl:value-of select="name(.)"/>",
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="enums">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name(.)"/>": {
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
"fields": [<xsl:apply-templates select="*" mode="field"/>]
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="objects">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name(.)"/>": {
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
"fields": [<xsl:apply-templates select="*[name()!='actions']" mode="field"/>]
|
||||
<xsl:apply-templates select="query|subscription|subscriptionHistory" mode="objects"/>
|
||||
<xsl:if test="actions">,"actions":[<xsl:apply-templates select="actions" mode="objects"/>]</xsl:if>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="query" mode="objects"></xsl:template>
|
||||
<xsl:template match="subscription" mode="objects"></xsl:template>
|
||||
<xsl:template match="subscriptionHistory" mode="objects"></xsl:template>
|
||||
<xsl:template match="views" mode="objects"></xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="actions" mode="objects">
|
||||
<xsl:for-each select="*">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{"method":"<xsl:value-of select="name()"/>",
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
"fields": [<xsl:apply-templates select="*" mode="field"/>]
|
||||
}
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
|
||||
<xsl:template match="*" mode="views">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name(.)"/>": {
|
||||
<xsl:for-each select="@*">
|
||||
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
|
||||
</xsl:for-each>
|
||||
<xsl:if test="source">"sources": [<xsl:apply-templates select="source" mode="views"/>]</xsl:if>
|
||||
<xsl:if test="set">,"fields":[<xsl:apply-templates select="set" mode="views"/>]</xsl:if>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="source" mode="views">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="@code"/>"
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="set" mode="views">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(field)=1">
|
||||
<xsl:apply-templates select="field"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
{<xsl:for-each select="field[position() = 1]">
|
||||
<xsl:for-each select="@*[name()!='source']">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
"<xsl:value-of select="name()"/>":
|
||||
<xsl:variable name="attrName"><xsl:value-of select="name()"/></xsl:variable>
|
||||
{
|
||||
<xsl:for-each select="parent::*/parent::*/field/@*[name()=$attrName]">
|
||||
<xsl:apply-templates select="." mode="withSource"/>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="field">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{"code": "<xsl:value-of select="name()"/>",
|
||||
<xsl:for-each select="@*">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='type'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='length'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='searchable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='sortable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='visible'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='ignore'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='required'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='cacheable'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="value">
|
||||
<xsl:if test="position() > 1">,</xsl:if>
|
||||
{"<xsl:value-of select="name()"/>":
|
||||
{
|
||||
<xsl:for-each select="@*">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='id'">"<xsl:value-of select="name()"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='code'">"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:when>
|
||||
<xsl:when test="name()='name'">"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="position() != last()">,</xsl:if>
|
||||
</xsl:for-each>
|
||||
}}
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="@*" mode="withSource">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='type'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='length'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='searchable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='sortable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='visible'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='required'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='cacheable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="parent::*/@source"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
<?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('..\data.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>
|
||||
172
clearing-parent/backend-api/src/main/resources/meta/xsl/web.xsl
Normal file
172
clearing-parent/backend-api/src/main/resources/meta/xsl/web.xsl
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output version="1.0" method="html" indent="no" encoding="UTF-8"/>
|
||||
|
||||
<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="*"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="enums">
|
||||
<xsl:apply-templates select="*" mode="enums"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="objects">
|
||||
<xsl:apply-templates select="*" mode="objects"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="views">
|
||||
<!--xsl:apply-templates select="*" mode="views"/-->
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="types">
|
||||
<h2>Data types</h2>
|
||||
<table class="sample" id="types" width="100%" border="0">
|
||||
<xsl:apply-templates select="*" mode="types"/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="types">
|
||||
<tr><td><xsl:value-of select="@id"/></td><td><xsl:value-of select="name()"/></td><td><xsl:value-of select="@type"/></td><td><xsl:value-of select="@name"/></td></tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*" mode="enums">
|
||||
<h2><!--1.<xsl:value-of select="position()"/>. --><xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h2>
|
||||
<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="objects">
|
||||
<h2><!--2.<xsl:value-of select="position()"/>. --><xsl:value-of select="name()"/> - <xsl:value-of select="@name"/></h2>
|
||||
<table class="sample" id="{name()}" width="100%" border="0">
|
||||
<tr><td width="5%">#</td><td width="10%">Поле</td><td width="20%">Тип</td><td width="45%">Наименование</td><!--td width="20%">Видимость</td--></tr>
|
||||
<xsl:apply-templates select="*" mode="field-objects"/>
|
||||
</table>
|
||||
<!--xsl:apply-templates select="query|subscription|subscriptionHistory" mode="objects"/>
|
||||
<xsl:if test="actions">,"actions":[<xsl:apply-templates select="actions" mode="objects"/>]</xsl:if>
|
||||
<xsl:if test="views">,"views":{<xsl:apply-templates select="views" mode="objects"/>}</xsl:if-->
|
||||
</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:template match="*" mode="field-objects">
|
||||
<tr><td><xsl:value-of select="position()"/></td>
|
||||
<td><xsl:value-of select="name()"/>
|
||||
<!--br/>поле: <xsl:value-of select="@field"/>
|
||||
<br/>столбец:<xsl:value-of select="@dbfield"/-->
|
||||
</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()='shortname'">
|
||||
<td>
|
||||
<i><xsl:value-of select="."/></i>. <!--br/-->
|
||||
<xsl:if test="../@name"><xsl:value-of select="../@name"/></xsl:if>
|
||||
<xsl:if test="../@link"><br/>Ссылается на объект :<xsl:value-of select="../@link"/></xsl:if>
|
||||
</td>
|
||||
<!--td>
|
||||
<xsl:if test="../@searchable">Поиск: <xsl:value-of select="../@searchable"/></xsl:if>
|
||||
<xsl:if test="../@sortable"><br/>Сортировка:<xsl:value-of select="../@sortable"/></xsl:if>
|
||||
<xsl:if test="../@visible"><br/>Видимость: <xsl:value-of select="../@visible"/></xsl:if>
|
||||
<xsl:if test="../@hidden"><br/>Скрыт:<xsl:value-of select="../@hidden"/></xsl:if>
|
||||
<xsl:if test="../@ignored"><br/>Игнорируемый: <xsl:value-of select="../@ignored"/></xsl:if>
|
||||
<xsl:if test="../@sendable"><br/>Отправляемый:<xsl:value-of select="../@sendable"/></xsl:if>
|
||||
</td-->
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="@*" mode="withSource">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name()='type'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='length'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='searchable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='sortable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='visible'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='required'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:when test="name()='cacheable'">"<xsl:value-of select="parent::*/@source"/>": <xsl:value-of select="."/></xsl:when>
|
||||
<xsl:otherwise>"<xsl:value-of select="parent::*/@source"/>": "<xsl:value-of select="."/>"</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
Loading…
Add table
Reference in a new issue