Ambrosia
view release on metacpan or search on metacpan
share/Templates/Templates/XSLT+DOJO/edit_json.xsl view on Meta::CPAN
<xslt:attribute name="lang">
<xslt:value-of select="/Application/@Language"/>
</xslt:attribute>
</xslt:if>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<xslt:apply-imports/>
<script type="text/javascript">
require([
"dijit/dijit",
"dijit/form/Form",
"dijit/form/Button",
"dijit/form/ValidationTextBox",
<xslt:for-each select="//atns:Application/atns:Entity/atns:Field[not(@Type=preceding-sibling::atns:Field/@Type)]">
<xslt:choose>
<xslt:when test="@Type='String' and not(@Hidden)">
"dijit/form/TextBox",</xslt:when>
<xslt:when test="@Type='Number'">
"dijit/form/NumberTextBox",</xslt:when>
<xslt:when test="@Type='Double' and not(@Hidden)">
</xslt:when>
<xslt:when test="@Type='Bool' and not(@Hidden)">
"dijit/form/CheckBox",</xslt:when>
<xslt:when test="@Type='Date' or @Type='Datetime'">
"dojo/date", "dojo/date/locale",
"dijit/form/DateTextBox",</xslt:when>
<xslt:when test="@type='Text'">
"dijit/form/Textarea",
"dijit/form/SimpleTextarea",
"dijit/Editor",</xslt:when>
</xslt:choose>
</xslt:for-each>
"dojo/domReady!", "dojo/parser"]);
</script>
</head>
<body class="claro">
<xsl:apply-templates select="//repository/mng_EWM" />
<xsl:apply-templates>
<xslt:attribute name="select"><xslt:value-of select="$UcAppName" /></xslt:attribute>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template>
<xslt:attribute name="match"><xslt:value-of select="$UcAppName" /></xslt:attribute>
<xslt:variable name="entityName" select="translate(//atns:Application/atns:Entity/@Name[1], $vUppercaseChars_CONST, $vLowercaseChars_CONST)"/>
<form method="POST">
<xsl:attribute name="action"><xsl:value-of select="@script" />/<xslt:value-of select="$entityName" /></xsl:attribute>
<!-- input type="hidden" name="m" value=''>
<xslt:attribute name="value">/save/<xslt:value-of select="$entityName" /></xslt:attribute>
</input -->
<xsl:apply-templates select="repository"/>
<!-- xsl:variable name="onClick">onClick:function(){ validate(); }</xsl:variable>
<button data-dojo-type="dijit.form.Button">
<xsl:attribute name="data-dojo-props"><xsl:value-of select="$onClick" /></xsl:attribute>
Validate form!</button -->
<button data-dojo-type="dijit.form.Button" data-dojo-props="type:'submit', value:'Submit'">Submit</button>
</form>
</xsl:template>
<xsl:template match="repository">
<xslt:apply-templates select="atns:Application/atns:Entity" />
</xsl:template>
</xsl:stylesheet>
</xslt:template>
<xslt:template match="atns:Application/atns:Entity">
<xslt:variable name="label">
<xslt:choose>
<xslt:when test="not(@Label) or @Label!=''">
<xslt:value-of select="@Label"/>
</xslt:when>
<xslt:otherwise>
<xslt:value-of select="@Name"/>
</xslt:otherwise>
</xslt:choose>
</xslt:variable>
<xslt:for-each select="atns:Key">
<input type="hidden">
<xslt:attribute name="name"><xslt:value-of select="atns:FieldRef/@Name"/></xslt:attribute>
<xsl:attribute name="value"><xsl:value-of>
<xslt:attribute name="select"><xslt:value-of select="concat('./',../@Name,'/@',atns:FieldRef/@Name)"/></xslt:attribute>
</xsl:value-of>
</xsl:attribute>
</input>
</xslt:for-each>
<table>
<tr><td colspan="2" align="center" style="font-size: 1.2em;">
<b>Edit <xslt:value-of select="$label" /></b>
</td></tr>
<xslt:apply-templates select="atns:Field"/>
<xslt:variable name="EId" select="@Id" />
<xslt:if test="boolean(/atns:Application/atns:EntitysRef/atns:Entity[@Id=/atns:Application/atns:Relations/atns:Relation[@RefId=$EId]/atns:EntityRef/@RefId and @Type='BIND'])">
<xslt:apply-templates
select="/atns:Application/atns:EntitysRef/atns:Entity[@Id=/atns:Application/atns:Relations/atns:Relation[@RefId=$EId]/atns:EntityRef/@RefId and @Type='BIND']" mode="bind" />
</xslt:if>
</table>
</xslt:template>
<xslt:template match="atns:Field">
<xslt:variable name="EId" select="../@Id" />
<xslt:variable name="FName" select="@Name" />
<xslt:variable name="label">
<xslt:choose>
<xslt:when test="not(@Label) or @Label!=''">
<xslt:value-of select="@Label"/>
</xslt:when>
<xslt:when test="boolean(/atns:Application/atns:Relations/atns:Relation/atns:EntityRef[@RefId=$EId and @To=$FName]/../@Type)">
<xslt:value-of select="/atns:Application/atns:Relations/atns:Relation/atns:EntityRef[@RefId=$EId]/../@Type"/>
( run in 2.342 seconds using v1.01-cache-2.11-cpan-e86d8f7595a )