meta.server.xslt new version

This commit is contained in:
ialbert 2022-10-28 11:25:16 +03:00
parent f2b28d0e3c
commit ca806a42e6

View file

@ -29,9 +29,12 @@
<xsl:template match="views">
,"views": {
<xsl:apply-templates select="*" mode="views"/>
<!--xsl:apply-templates select="*" mode="views"/-->
}
</xsl:template>
<xsl:template match="reports"></xsl:template>
<xsl:template match="types">
@ -41,25 +44,25 @@
</xsl:template>
<xsl:template match="type" mode="types">
<xsl:template match="*" mode="types">
<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: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:for-each select="@*[name()!='class']">
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
</xsl:for-each>
"fields": [<xsl:apply-templates select="field"/>]
,"values": [<xsl:apply-templates select="value"/>]
"fields": [<xsl:apply-templates select="*" mode="field"/>]
}
</xsl:template>
@ -67,60 +70,36 @@
<xsl:template match="*" mode="objects">
<xsl:if test="position() > 1">,</xsl:if>
"<xsl:value-of select="name(.)"/>": {
<xsl:for-each select="@*">
<xsl:for-each select="@*[name()!='class']">
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
</xsl:for-each>
"fields": [<xsl:apply-templates select="field"/>]
"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:if test="views">,"views":{<xsl:apply-templates select="views" mode="objects"/>}</xsl:if>
}
</xsl:template>
<xsl:template match="query" mode="objects">
,"query": {
"enabled": <xsl:value-of select="@enabled"/>,
"destination": "<xsl:value-of select="@destination"/>"
}
</xsl:template>
<xsl:template match="subscription" mode="objects">
,"subscription": {
"enabled": <xsl:value-of select="@enabled"/>,
"destination": "<xsl:value-of select="@destination"/>"
}
</xsl:template>
<xsl:template match="subscriptionHistory" mode="objects">
,"subscriptionHistory": {
"enabled": <xsl:value-of select="@enabled"/>,
"destination": "<xsl:value-of select="@destination"/>"
}
</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:if test="position() > 1">,</xsl:if>
{
<xsl:for-each select="@*">
"<xsl:value-of select="name()"/>": "<xsl:value-of select="."/>",
</xsl:for-each>
"fields": [<xsl:apply-templates select="field"/>]
}
<xsl:for-each select="*">
<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:for-each>
</xsl:template>
<xsl:template match="views" mode="objects">
<xsl:if test="position() > 1">,</xsl:if>
"<xsl:value-of select="@code"/>": {
"name": "<xsl:value-of select="@name"/>",
"fields": [<xsl:apply-templates select="field"/>]
}
</xsl:template>
<xsl:template match="*" mode="views">
@ -167,9 +146,10 @@
</xsl:template>
<xsl:template match="field">
<xsl:template match="*" mode="field">
<xsl:if test="position() > 1">,</xsl:if>
{
{"<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>
@ -177,18 +157,19 @@
<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()='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>
@ -199,7 +180,7 @@
</xsl:choose>
<xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each>
}
}}
</xsl:template>