Commit 18a71f16 authored by Stephane Crozat's avatar Stephane Crozat
Browse files

Adding variable year to XSLT and setting to 2020 #WORKAROUND #TODO

parent 50efce17
......@@ -5,38 +5,40 @@
version="2.0"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:of="scpf.org:office"
xmlns:of="scpf.org:office"
>
<xsl:output method="text"></xsl:output>
<xsl:variable name="year">2020</xsl:variable>
<xsl:variable name="logintitle">Login UTC du responsable UTC</xsl:variable>
<xsl:template match="/sc:item">
<xsl:apply-templates select="of:webSite/sp:home/of:page/sp:subPage" mode="login"/>
<xsl:text>BEGIN;</xsl:text>
<xsl:apply-templates select="of:webSite/sp:home/of:page/sp:subPage"/>
<xsl:template match="/sc:item">
<xsl:apply-templates select="of:webSite/sp:home/of:page/sp:subPage" mode="login"/>
<xsl:text>BEGIN;</xsl:text>
<xsl:apply-templates select="of:webSite/sp:home/of:page/sp:subPage"/>
<xsl:text>COMMIT;</xsl:text>
</xsl:template>
<xsl:template match="sp:subPage" mode="login">
<xsl:template match="sp:subPage" mode="login">
<xsl:text>INSERT INTO localuser (utclogin) VALUES ('</xsl:text>
<xsl:value-of select="document(@sc:refUri)/sc:item//sp:info[of:block/of:blockM/sp:title=$logintitle]//sc:para[1]"/>
<xsl:text>');</xsl:text>
<xsl:text>');</xsl:text>
</xsl:template>
<xsl:template match="sp:subPage">
<xsl:apply-templates select="document(@sc:refUri)/sc:item" mode="api">
<xsl:with-param name="code">
<xsl:value-of select="substring(@sc:refUri,string-length(@sc:refUri)-11,4)"/>
</xsl:with-param>
</xsl:apply-templates>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="sc:item" mode="api">
<xsl:param name="code"/>
<xsl:variable name="id">gen_random_uuid()</xsl:variable>
<xsl:param name="code"/>
<xsl:variable name="id">gen_random_uuid()</xsl:variable>
<xsl:variable name="begin">
<xsl:value-of select="substring(.//sp:info[of:block/of:blockM/sp:title='Période']//sc:para[1],1,5)"/>
</xsl:variable>
......@@ -50,8 +52,8 @@
<xsl:value-of select="
number(substring(.//sp:info[of:block/of:blockM/sp:title='Période']//sc:para[1],7,2))
-
number(substring(.//sp:info[of:block/of:blockM/sp:title='Période']//sc:para[1],1,2))
+1
number(substring(.//sp:info[of:block/of:blockM/sp:title='Période']//sc:para[1],1,2))
+1
"
/>
</xsl:variable>
......@@ -63,20 +65,20 @@
</xsl:variable>
<xsl:variable name="login">
<xsl:value-of select=".//sp:info[of:block/of:blockM/sp:title=$logintitle]//sc:para[1]"/>
</xsl:variable>
INSERT INTO api (id,dbegin,code,name,description,duration,size,ects,resplogin) VALUES (
</xsl:variable>
INSERT INTO api (id,dbegin,code,name,description,duration,size,ects,resplogin) VALUES (
<xsl:value-of select="$id"/>,
TO_DATE('<xsl:value-of select="$begin"/>/19','DD/MM/YY'),
TO_DATE('<xsl:value-of select="$begin"/>/<xsl:value-of select="$year"/>','DD/MM/YYYY'),
<xsl:value-of select="$code"/>,
'<xsl:value-of select="$title"></xsl:value-of>',
'<xsl:value-of select="$longtitle"></xsl:value-of>',
'<xsl:value-of select="$longtitle"></xsl:value-of>',
<xsl:value-of select="$duration"/>,
<xsl:value-of select="$size"/>,
<xsl:value-of select="$ects"/>,
'<xsl:value-of select="$login"/>'
<xsl:text>);</xsl:text>
'<xsl:value-of select="$login"/>'
<xsl:text>);</xsl:text>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
</xsl:stylesheet>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment