mirror of
https://github.com/zerobig/vscode-1c-metadata-viewer.git
synced 2024-11-21 17:56:31 +02:00
XSLT рефакторинг
This commit is contained in:
parent
495409429a
commit
580ce5dcf6
126
xslt/button.xsl
Normal file
126
xslt/button.xsl
Normal file
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet
|
||||
version="3.0"
|
||||
xpath-default-namespace="http://v8.1c.ru/8.3/xcf/logform"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:v8="http://v8.1c.ru/8.1/data/core"
|
||||
xmlns:xr="http://v8.1c.ru/8.3/xcf/readable"
|
||||
>
|
||||
|
||||
<xsl:template match="Button">
|
||||
<xsl:variable name="commandName" select="tokenize(CommandName, '\.')[last()]" />
|
||||
<xsl:choose>
|
||||
<!-- Гиперссылка -->
|
||||
<xsl:when test="Type = 'Hyperlink'">
|
||||
<div class="element">
|
||||
<xsl:if test="Picture or /Form/Commands/Command[@name=$commandName]/Picture/xr:Ref">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:choose>
|
||||
<!-- Картинка задана на кнопке -->
|
||||
<xsl:when test="Picture">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(Picture/xr:Ref, 'StdPicture.')">
|
||||
<xsl:value-of select="concat(Picture/xr:Ref, '.svg')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(Picture/xr:Ref, '/Ext/Picture/Picture.png')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- Картинка определена в команде -->
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, 'StdPicture.')">
|
||||
<xsl:value-of select="concat(/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, '.svg')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, '/Ext/Picture/Picture.png')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:if>
|
||||
<a href="#">
|
||||
<xsl:choose>
|
||||
<!-- Текст из кнопки -->
|
||||
<xsl:when test="Title">
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<!-- Текст из команды -->
|
||||
<xsl:when test="/Form/Commands/Command[@name=$commandName]/Title">
|
||||
<xsl:value-of select="/Form/Commands/Command[@name=$commandName]/Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<!-- Текст из идентификатора команды через camel case преобразование -->
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="SplitCamelCase">
|
||||
<xsl:with-param name="text" select="$commandName" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</a>
|
||||
</div>
|
||||
<xsl:if test="ExtendedTooltip/Title">
|
||||
<div class="tooltip">
|
||||
<xsl:value-of select="ExtendedTooltip/Title/v8:item/v8:content/text()" />
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:if test="not(LocationInCommandBar = 'InAdditionalSubmenu')">
|
||||
<button>
|
||||
<xsl:choose>
|
||||
<!-- Кнопка с картинкой -->
|
||||
<xsl:when test="Representation = 'Picture'">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:choose>
|
||||
<!-- Картинка задана на кнопке -->
|
||||
<xsl:when test="Picture">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(Picture/xr:Ref, 'StdPicture.')">
|
||||
<xsl:value-of select="concat(Picture/xr:Ref, '.svg')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(Picture/xr:Ref, '/Ext/Picture/Picture.png')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- Картинка определена в команде -->
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, 'StdPicture.')">
|
||||
<xsl:value-of select="concat(/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, '.svg')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, '/Ext/Picture/Picture.png')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:when>
|
||||
<!-- Только текст и текст задан на кнопке -->
|
||||
<xsl:when test="Representation = 'Text' and Title">
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<!-- Только текст и текст определен в команде -->
|
||||
<xsl:when test="Representation = 'Text' and not(Title)">
|
||||
<xsl:value-of select="/Form/Commands/Command[@name=$commandName]/Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- TextAndPicture -->
|
||||
<!-- TODO: -->
|
||||
<xsl:value-of select="@name" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</button>
|
||||
</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
72
xslt/checkbox-field.xsl
Normal file
72
xslt/checkbox-field.xsl
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet
|
||||
version="3.0"
|
||||
xpath-default-namespace="http://v8.1c.ru/8.3/xcf/logform"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:v8="http://v8.1c.ru/8.1/data/core"
|
||||
xmlns:xr="http://v8.1c.ru/8.3/xcf/readable"
|
||||
>
|
||||
|
||||
<xsl:template match="CheckBoxField">
|
||||
<xsl:choose>
|
||||
<!-- Колонка таблицы -->
|
||||
<xsl:when test="../../name() = 'Table' or ../../name() = 'ColumnGroup'">
|
||||
<th>
|
||||
<xsl:if test="not(Width)">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<div>
|
||||
<xsl:if test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="DataPath" />
|
||||
</div>
|
||||
</th>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- Обычное поле формы -->
|
||||
<div class="element">
|
||||
<xsl:if test="not(TitleLocation) or TitleLocation = 'Left'">
|
||||
<label>
|
||||
<xsl:choose>
|
||||
<xsl:when test="Title">
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="SplitCamelCase">
|
||||
<xsl:with-param name="text" select="@name" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</label>
|
||||
</xsl:if>
|
||||
<input type="checkbox" />
|
||||
<xsl:if test="TitleLocation = 'Right'">
|
||||
<label>
|
||||
<xsl:choose>
|
||||
<xsl:when test="Title">
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="SplitCamelCase">
|
||||
<xsl:with-param name="text" select="@name" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</label>
|
||||
</xsl:if>
|
||||
</div>
|
||||
<xsl:if test="ExtendedTooltip/Title">
|
||||
<div class="tooltip">
|
||||
<xsl:value-of select="ExtendedTooltip/Title/v8:item/v8:content/text()" />
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
368
xslt/form.xsl
368
xslt/form.xsl
@ -8,9 +8,14 @@
|
||||
|
||||
<xsl:output method="html" />
|
||||
|
||||
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyzабвгдеёжзийклмнопрстуфхцчшщъыьэюя'" />
|
||||
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ'" />
|
||||
<xsl:variable name="digits">0123456789</xsl:variable>
|
||||
<xsl:import href="button.xsl" />
|
||||
<xsl:import href="checkbox-field.xsl" />
|
||||
<xsl:import href="input-field.xsl" />
|
||||
<xsl:import href="label-decoration.xsl" />
|
||||
<xsl:import href="label-field.xsl" />
|
||||
<xsl:import href="select-field.xsl" />
|
||||
|
||||
<xsl:import href="func/split-camel-case.xsl" />
|
||||
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
@ -156,331 +161,6 @@
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="LabelDecoration">
|
||||
<div class="label">
|
||||
<xsl:if test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="Button">
|
||||
<xsl:choose>
|
||||
<!-- Гиперссылка -->
|
||||
<xsl:when test="Type = 'Hyperlink'">
|
||||
<div class="element">
|
||||
<xsl:variable name="commandName" select="tokenize(CommandName, '\.')[last()]" />
|
||||
<xsl:if test="Picture or /Form/Commands/Command[@name=$commandName]/Picture/xr:Ref">
|
||||
<img>
|
||||
<xsl:attribute name="src">
|
||||
<xsl:choose>
|
||||
<!-- Картинка задана на кнопке -->
|
||||
<xsl:when test="Picture">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(Picture/xr:Ref, 'StdPicture.')">
|
||||
<xsl:value-of select="concat(Picture/xr:Ref, '.svg')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(Picture/xr:Ref, '/Ext/Picture/Picture.png')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- Картинка определена в команде -->
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, 'StdPicture.')">
|
||||
<xsl:value-of select="concat(/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, '.svg')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, '/Ext/Picture/Picture.png')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:if>
|
||||
<a href="#">
|
||||
<xsl:choose>
|
||||
<xsl:when test="Title">
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- TODO: <xsl:evaluate xpath="CommandName/text()" /> -->
|
||||
<xsl:call-template name="SplitCamelCase">
|
||||
<xsl:with-param name="text" select="@name" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</a>
|
||||
</div>
|
||||
<xsl:if test="ExtendedTooltip/Title">
|
||||
<div class="tooltip">
|
||||
<xsl:value-of select="ExtendedTooltip/Title/v8:item/v8:content/text()" />
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:if test="not(LocationInCommandBar = 'InAdditionalSubmenu')">
|
||||
<button>
|
||||
<xsl:choose>
|
||||
<!-- Кнопка с картинкой -->
|
||||
<xsl:when test="Representation = 'Picture'">
|
||||
<img>
|
||||
<xsl:variable name="root" select="/" />
|
||||
<xsl:attribute name="src">
|
||||
<xsl:choose>
|
||||
<!-- Картинка задана на кнопке -->
|
||||
<xsl:when test="Picture">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(Picture/xr:Ref, 'StdPicture.')">
|
||||
<xsl:value-of select="concat(Picture/xr:Ref, '.svg')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(Picture/xr:Ref, '/Ext/Picture/Picture.png')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- Картинка определена в команде -->
|
||||
<xsl:otherwise>
|
||||
<xsl:for-each select="tokenize(CommandName, '\.')">
|
||||
<xsl:if test="position() = last()">
|
||||
<xsl:variable name="commandName" select="."/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($root/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, 'StdPicture.')">
|
||||
<xsl:value-of select="concat($root/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, '.svg')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($root/Form/Commands/Command[@name=$commandName]/Picture/xr:Ref, '/Ext/Picture/Picture.png')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</img>
|
||||
</xsl:when>
|
||||
<!-- Только текст и текст задан на кнопке -->
|
||||
<xsl:when test="Representation = 'Text' and Title">
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<!-- Только текст и текст определен в команде -->
|
||||
<xsl:when test="Representation = 'Text' and not(Title)">
|
||||
<xsl:variable name="root" select="/"/>
|
||||
<xsl:for-each select="tokenize(CommandName, '\.')">
|
||||
<xsl:if test="position() = last()">
|
||||
<xsl:variable name="commandName" select="."/>
|
||||
<xsl:value-of select="$root/Form/Commands/Command[@name=$commandName]/Title/v8:item/v8:content/text()" />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- TextAndPicture -->
|
||||
<!-- TODO: -->
|
||||
<xsl:value-of select="@name" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</button>
|
||||
</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="InputField">
|
||||
<xsl:choose>
|
||||
<!-- Колонка таблицы -->
|
||||
<xsl:when test="../../name() = 'Table' or ../../name() = 'ColumnGroup'">
|
||||
<th>
|
||||
<xsl:if test="not(Width)">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<div>
|
||||
<xsl:if test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="DataPath" />
|
||||
</div>
|
||||
</th>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- Обычное поле формы -->
|
||||
<div class="element">
|
||||
<xsl:if test="TitleLocation = 'Top'">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="'label-top'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="HorizontalStretch = 'true'">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="not(TitleLocation = 'None')">
|
||||
<label>
|
||||
<xsl:variable name="dataPath" select="DataPath"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="Title">
|
||||
<xsl:value-of select="concat(Title/v8:item/v8:content/text(), ': ')" />
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($dataPath, 'Объект.')">
|
||||
<xsl:value-of select="concat($dataPath, ': ')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(/Form/Attributes/Attribute[@name=$dataPath]/Title/v8:item/v8:content/text(), ': ')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</label>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="MultiLine = 'true'">
|
||||
<textarea>
|
||||
<xsl:if test="HorizontalStretch = 'true'">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:attribute name="rows">
|
||||
<xsl:value-of select="Height" />
|
||||
</xsl:attribute>
|
||||
</textarea>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<input class="input">
|
||||
<xsl:if test="InputHint">
|
||||
<xsl:attribute name="placeholder">
|
||||
<xsl:value-of select="InputHint/v8:item/v8:content" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="HorizontalStretch = 'true'">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</input>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="InputField/ChoiceList">
|
||||
<div class="element">
|
||||
<xsl:if test="not(TitleLocation = 'None')">
|
||||
<label>
|
||||
<xsl:value-of select="concat(../Title/v8:item/v8:content/text(), ': ')" />
|
||||
</label>
|
||||
</xsl:if>
|
||||
<select class="input">
|
||||
<xsl:apply-templates select="xr:Item" />
|
||||
</select>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="xr:Item">
|
||||
<option>
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="xr:Value/Value" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="xr:Value/Presentation/v8:item/v8:content" />
|
||||
</option>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="LabelField">
|
||||
<th>
|
||||
<xsl:if test="not(Width)">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<div>
|
||||
<xsl:if test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="DataPath" />
|
||||
</div>
|
||||
</th>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="CheckBoxField">
|
||||
<xsl:choose>
|
||||
<!-- Колонка таблицы -->
|
||||
<xsl:when test="../../name() = 'Table' or ../../name() = 'ColumnGroup'">
|
||||
<th>
|
||||
<xsl:if test="not(Width)">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<div>
|
||||
<xsl:if test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="DataPath" />
|
||||
</div>
|
||||
</th>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- Обычное поле формы -->
|
||||
<div class="element">
|
||||
<xsl:if test="not(TitleLocation) or TitleLocation = 'Left'">
|
||||
<label>
|
||||
<xsl:choose>
|
||||
<xsl:when test="Title">
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="SplitCamelCase">
|
||||
<xsl:with-param name="text" select="@name" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</label>
|
||||
</xsl:if>
|
||||
<input type="checkbox" />
|
||||
<xsl:if test="TitleLocation = 'Right'">
|
||||
<label>
|
||||
<xsl:choose>
|
||||
<xsl:when test="Title">
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="SplitCamelCase">
|
||||
<xsl:with-param name="text" select="@name" />
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</label>
|
||||
</xsl:if>
|
||||
</div>
|
||||
<xsl:if test="ExtendedTooltip/Title">
|
||||
<div class="tooltip">
|
||||
<xsl:value-of select="ExtendedTooltip/Title/v8:item/v8:content/text()" />
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="Pages">
|
||||
<div class="tabbed">
|
||||
<xsl:for-each select="ChildItems/Page">
|
||||
@ -607,36 +287,4 @@
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="SplitCamelCase">
|
||||
<xsl:param name="text" />
|
||||
<xsl:param name="digitsMode" select="0" />
|
||||
<xsl:param name="firstIteration" select="0" />
|
||||
|
||||
<xsl:if test="$text != ''">
|
||||
<xsl:variable name="letter" select="substring($text, 1, 1)" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$firstIteration != 0 and contains($uppercase, $letter)">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="translate($letter, $uppercase, $lowercase)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($digits, $letter)">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$digitsMode != 1">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="$letter" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$letter"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:call-template name="SplitCamelCase">
|
||||
<xsl:with-param name="text" select="substring-after($text, $letter)" />
|
||||
<xsl:with-param name="digitsMode" select="contains($digits, $letter)" />
|
||||
<xsl:with-param name="firstIteration" select="1" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
46
xslt/func/split-camel-case.xsl
Normal file
46
xslt/func/split-camel-case.xsl
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet
|
||||
version="3.0"
|
||||
xpath-default-namespace="http://v8.1c.ru/8.3/xcf/logform"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:v8="http://v8.1c.ru/8.1/data/core"
|
||||
xmlns:xr="http://v8.1c.ru/8.3/xcf/readable"
|
||||
>
|
||||
|
||||
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyzабвгдеёжзийклмнопрстуфхцчшщъыьэюя'" />
|
||||
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ'" />
|
||||
<xsl:variable name="digits">0123456789</xsl:variable>
|
||||
|
||||
<xsl:template name="SplitCamelCase">
|
||||
<xsl:param name="text" />
|
||||
<xsl:param name="digitsMode" select="0" />
|
||||
<xsl:param name="firstIteration" select="0" />
|
||||
|
||||
<xsl:if test="$text != ''">
|
||||
<xsl:variable name="letter" select="substring($text, 1, 1)" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$firstIteration != 0 and contains($uppercase, $letter)">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="translate($letter, $uppercase, $lowercase)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($digits, $letter)">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$digitsMode != 1">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="$letter" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$letter"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:call-template name="SplitCamelCase">
|
||||
<xsl:with-param name="text" select="substring-after($text, $letter)" />
|
||||
<xsl:with-param name="digitsMode" select="contains($digits, $letter)" />
|
||||
<xsl:with-param name="firstIteration" select="1" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
99
xslt/input-field.xsl
Normal file
99
xslt/input-field.xsl
Normal file
@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet
|
||||
version="3.0"
|
||||
xpath-default-namespace="http://v8.1c.ru/8.3/xcf/logform"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:v8="http://v8.1c.ru/8.1/data/core"
|
||||
xmlns:xr="http://v8.1c.ru/8.3/xcf/readable"
|
||||
>
|
||||
|
||||
<xsl:template match="InputField">
|
||||
<xsl:choose>
|
||||
<!-- Колонка таблицы -->
|
||||
<xsl:when test="../../name() = 'Table' or ../../name() = 'ColumnGroup'">
|
||||
<th>
|
||||
<xsl:if test="not(Width)">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<div>
|
||||
<xsl:if test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="DataPath" />
|
||||
</div>
|
||||
</th>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- Обычное поле формы -->
|
||||
<div class="element">
|
||||
<xsl:if test="TitleLocation = 'Top'">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:value-of select="'label-top'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="HorizontalStretch = 'true'">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="not(TitleLocation = 'None')">
|
||||
<label>
|
||||
<xsl:variable name="dataPath" select="DataPath"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="Title">
|
||||
<xsl:value-of select="concat(Title/v8:item/v8:content/text(), ': ')" />
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with($dataPath, 'Объект.')">
|
||||
<xsl:value-of select="concat($dataPath, ': ')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(/Form/Attributes/Attribute[@name=$dataPath]/Title/v8:item/v8:content/text(), ': ')" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</label>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="MultiLine = 'true'">
|
||||
<textarea>
|
||||
<xsl:if test="HorizontalStretch = 'true'">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:attribute name="rows">
|
||||
<xsl:value-of select="Height" />
|
||||
</xsl:attribute>
|
||||
</textarea>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<input class="input">
|
||||
<xsl:if test="InputHint">
|
||||
<xsl:attribute name="placeholder">
|
||||
<xsl:value-of select="InputHint/v8:item/v8:content" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="HorizontalStretch = 'true'">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</input>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
21
xslt/label-decoration.xsl
Normal file
21
xslt/label-decoration.xsl
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet
|
||||
version="3.0"
|
||||
xpath-default-namespace="http://v8.1c.ru/8.3/xcf/logform"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:v8="http://v8.1c.ru/8.1/data/core"
|
||||
xmlns:xr="http://v8.1c.ru/8.3/xcf/readable"
|
||||
>
|
||||
|
||||
<xsl:template match="LabelDecoration">
|
||||
<div class="label">
|
||||
<xsl:if test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="Title/v8:item/v8:content/text()" />
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
28
xslt/label-field.xsl
Normal file
28
xslt/label-field.xsl
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet
|
||||
version="3.0"
|
||||
xpath-default-namespace="http://v8.1c.ru/8.3/xcf/logform"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:v8="http://v8.1c.ru/8.1/data/core"
|
||||
xmlns:xr="http://v8.1c.ru/8.3/xcf/readable"
|
||||
>
|
||||
|
||||
<xsl:template match="LabelField">
|
||||
<th>
|
||||
<xsl:if test="not(Width)">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="'width: 100%'" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<div>
|
||||
<xsl:if test="Width">
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="concat('width: ', number(Width) * 10, 'px;')" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="DataPath" />
|
||||
</div>
|
||||
</th>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
32
xslt/select-field.xsl
Normal file
32
xslt/select-field.xsl
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet
|
||||
version="3.0"
|
||||
xpath-default-namespace="http://v8.1c.ru/8.3/xcf/logform"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:v8="http://v8.1c.ru/8.1/data/core"
|
||||
xmlns:xr="http://v8.1c.ru/8.3/xcf/readable"
|
||||
>
|
||||
|
||||
<xsl:template match="InputField/ChoiceList">
|
||||
<div class="element">
|
||||
<xsl:if test="not(TitleLocation = 'None')">
|
||||
<label>
|
||||
<xsl:value-of select="concat(../Title/v8:item/v8:content/text(), ': ')" />
|
||||
</label>
|
||||
</xsl:if>
|
||||
<select class="input">
|
||||
<xsl:apply-templates select="xr:Item" />
|
||||
</select>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="xr:Item">
|
||||
<option>
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="xr:Value/Value" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="xr:Value/Presentation/v8:item/v8:content" />
|
||||
</option>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Loading…
Reference in New Issue
Block a user