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

Fix #2

parent 3f7100e4
......@@ -4,6 +4,7 @@ DROP TABLE IF EXISTS api CASCADE;
CREATE TABLE api (
code INTEGER PRIMARY KEY,
name TEXT NOT NULL,
description TEXT,
year INTEGER NOT NULL,
semester CHAR(1) NOT NULL,
dbegin DATE NOT NULL,
......
......@@ -12,7 +12,7 @@
<xsl:template match="/sc:item">
<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:text>COMMIT;</xsl:text>
......@@ -28,29 +28,32 @@
</xsl:template>
<xsl:template match="sc:item" mode="api">
<xsl:param name="code"/>
<xsl:param name="code"/>
<xsl:variable name="title">
<xsl:variable name="quote">'</xsl:variable>
<xsl:value-of select="replace(of:section/of:sectionM/sp:title,'''','''''')"/>
</xsl:variable>
<xsl:variable name="longtitle">
<xsl:value-of select="replace(.//sp:emphasis[1]//sc:para[1],'''','''''')"/>
</xsl:variable>
<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 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 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 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 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: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,
'H',
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