Commit 205ac5a8 authored by Stephane Crozat's avatar Stephane Crozat
Browse files

Fix #2

parent 3f7100e4
...@@ -4,6 +4,7 @@ DROP TABLE IF EXISTS api CASCADE; ...@@ -4,6 +4,7 @@ DROP TABLE IF EXISTS api CASCADE;
CREATE TABLE api ( CREATE TABLE api (
code INTEGER PRIMARY KEY, code INTEGER PRIMARY KEY,
name TEXT NOT NULL, name TEXT NOT NULL,
description TEXT,
year INTEGER NOT NULL, year INTEGER NOT NULL,
semester CHAR(1) NOT NULL, semester CHAR(1) NOT NULL,
dbegin DATE NOT NULL, dbegin DATE NOT NULL,
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<xsl:template match="/sc:item"> <xsl:template match="/sc:item">
<xsl:text>BEGIN;</xsl:text> <xsl:text>BEGIN;</xsl:text>
<xsl:text>INSERT INTO api (code,name,year,semester,dbegin,dend,size,ects,mail) VALUES</xsl:text> <xsl:text>INSERT INTO api (code,name,description,year,semester,dbegin,dend,size,ects,mail) VALUES</xsl:text>
<xsl:apply-templates select="of:webSite/sp:home/of:page/sp:subPage"/> <xsl:apply-templates select="of:webSite/sp:home/of:page/sp:subPage"/>
; ;
<xsl:text>COMMIT;</xsl:text> <xsl:text>COMMIT;</xsl:text>
...@@ -28,29 +28,32 @@ ...@@ -28,29 +28,32 @@
</xsl:template> </xsl:template>
<xsl:template match="sc:item" mode="api"> <xsl:template match="sc:item" mode="api">
<xsl:param name="code"/> <xsl:param name="code"/>
<xsl:variable name="title"> <xsl:variable name="title">
<xsl:variable name="quote">'</xsl:variable>
<xsl:value-of select="replace(of:section/of:sectionM/sp:title,'''','''''')"/> <xsl:value-of select="replace(of:section/of:sectionM/sp:title,'''','''''')"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="longtitle">
<xsl:value-of select="replace(.//sp:emphasis[1]//sc:para[1],'''','''''')"/>
</xsl:variable>
<xsl:variable name="begin"> <xsl:variable name="begin">
<xsl:value-of select="substring(.//sp:info[of:block/of:blockM/sp:title='Période']//sc:para,1,5)"/> <xsl:value-of select="substring(.//sp:info[of:block/of:blockM/sp:title='Période']//sc:para[1],1,5)"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="end"> <xsl:variable name="end">
<xsl:value-of select="substring(.//sp:info[of:block/of:blockM/sp:title='Période']//sc:para,7,11)"/> <xsl:value-of select="substring(.//sp:info[of:block/of:blockM/sp:title='Période']//sc:para[1],7,11)"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="size"> <xsl:variable name="size">
<xsl:value-of select="number(.//sp:info[of:block/of:blockM/sp:title='Capacité d''accueil']//sc:para)"/> <xsl:value-of select="number(.//sp:info[of:block/of:blockM/sp:title='Capacité d''accueil']//sc:para[1])"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="ects"> <xsl:variable name="ects">
<xsl:value-of select="number(.//sp:info[of:block/of:blockM/sp:title='ECTS']//sc:para)"/> <xsl:value-of select="number(.//sp:info[of:block/of:blockM/sp:title='ECTS']//sc:para[1])"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="mail"> <xsl:variable name="mail">
<xsl:value-of select=".//sp:info[of:block/of:blockM/sp:title='Mail']//sc:para"/> <xsl:value-of select=".//sp:info[of:block/of:blockM/sp:title='Mail']//sc:para[1]"/>
</xsl:variable> </xsl:variable>
( (
<xsl:value-of select="$code"/>, <xsl:value-of select="$code"/>,
'<xsl:value-of select="substring($title,8)"></xsl:value-of>', '<xsl:value-of select="$title"></xsl:value-of>',
'<xsl:value-of select="$longtitle"></xsl:value-of>',
2019, 2019,
'H', 'H',
TO_DATE('<xsl:value-of select="$begin"/>/19','DD/MM/YY'), TO_DATE('<xsl:value-of select="$begin"/>/19','DD/MM/YY'),
......
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