This is a sample of xslt which transform xml to sql.
I confirmed its result by using this link
https://www.freeformatter.com/xsl-transformer.html#ad-output
XSL having basic function and selection method of XPath.
It is possible to build Logic of Translation from GUI values to SQL.
Followings are the example.
XML
<Models>
  <model_1>
    <table>TBL_SAMPLE</table>
    <param_1>101</param_1>
    <param_2>102</param_2>
  </model_1>
</Models>
XSL
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output method="text" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
    <xsl:template match="//model_1">
        SELECT *
        FROM <xsl:value-of select="table" />
        WHERE p1 = <xsl:value-of select="param_1" />
        AND   p2 = '<xsl:value-of select="param_2" />'
    </xsl:template>
</xsl:transform>
Result
        SELECT * 
        FROM TBL_SAMPLE 
        WHERE p1 = 101
        AND   p2 = '102'
 
 
0 件のコメント:
コメントを投稿