Commit 105f9ec4 authored by Stephane Crozat's avatar Stephane Crozat

Merge branch 'master' of https://gitlab.utc.fr/crozatst/hdoc

parents 40f91e25 b26e7d12
......@@ -23,6 +23,11 @@
<xsl:apply-templates select="@*|node()"/>
</em>
</xsl:template>
<xsl:template match="span[@data-color]">
<em>
<xsl:apply-templates select="node()"/>
</em>
</xsl:template>
<xsl:template match="s">
<em>
<xsl:apply-templates select="@*|node()"/>
......
This diff is collapsed.
......@@ -24,11 +24,11 @@ This project can be used alone if you want to import an HDOC file into basex.
## User stories
------------------
- Among a group of courses, user can search by title, author or keywords of the course.
- By searching a certain keyword, user can obtain the sections that contain it with their hierarchy levels in the course.
- In a certain section, by searching a key word, user can obtain paragraphes that contain it.
- User can get definitions related to a keyword
- User can get examples whose titles contain a keyword
- Among a group of courses, user can search by title, author or keywords of the course.
- By searching a certain keyword, user can obtain the sections that contain it with their hierarchy levels in the course.
- In a certain section, by searching a key word, user can obtain paragraphes that contain it.
- User can get definitions related to a keyword
- User can get examples whose titles contain a keyword
Step by step :
[Step 1 : File transformation]
......@@ -38,8 +38,11 @@ Step by step :
[Step 2 : Create data base in basex]
- Download and install [BaseX](http://basex.org/products/download/all-downloads/)
- Run BasexGui
- In the Text Editor of BaseX, open the command script "createbd.bxs" in folder [/basex/command] (https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/command).
- In the Text Editor of BaseX, open the command script "createbd.bxs" in folder [`basex/command`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/command).
Follow the instructions in the script, and then execute it.
[Step 3 : Make XQuery request]
-
\ No newline at end of file
- In the Text Editor of BaseX, you can open and execute xquery scripts in folder [`basex/xquery`](https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex/basex/xquery).
- Available scripts :
* searchDocByAuthor.hq
* searchDocByTitle.hq
\ No newline at end of file
application/epub+zip
application/epub+zip
\ No newline at end of file
......@@ -5,9 +5,9 @@
xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
xmlns="http://www.w3.org/1999/xhtml"
version="2.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/html" priority="10">
<xsl:for-each select="body/section">
<xsl:variable name="path">../../../retour/oebps/chapitres/chapitre<xsl:number level="multiple" count="section" format="1"/>.xhtml</xsl:variable>
......@@ -24,27 +24,27 @@
</xsl:result-document>
</xsl:for-each>
</xsl:template>
<xsl:template match="section" priority="3">
<xsl:element name="h{count(ancestor::section)+1}">
<xsl:value-of select="header/h1"/>
<xsl:apply-templates select="div|section"/>
</xsl:element>
<xsl:apply-templates select="div|section"/>
</xsl:template>
<!-- Identity transformation -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Namespace substitution for hdoc elements -->
</xsl:copy>
</xsl:template>
<!-- Namespace substitution for hdoc elements -->
<xsl:template match="*" priority="1">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dc="http://www.idpf.org/2007/opf"
xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
exclude-result-prefixes="xs"
xmlns="http://www.idpf.org/2007/opf"
version="2.0">
<xsl:import href="content/metadata.xsl"/>
......@@ -13,7 +13,7 @@
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="html">
<package unique-identifier="BookID" version="3.0">
<package unique-identifier="BookID" version="2.0">
<xsl:call-template name="metadata"/>
<xsl:call-template name="manifest"/>
<xsl:call-template name="spine"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dc="http://www.idpf.org/2007/opf"
xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
exclude-result-prefixes="xs"
xmlns="http://www.idpf.org/2007/opf"
version="2.0">
<xsl:template name="manifest">
<manifest>
<item id="tDMncx" href="tableDesMatieres.ncx" media-type="application/x-dtbncx+xml" />
<item id="tDMncx" href="tableDesMatieres.ncx" media-type="application/x-dtbncx+xml"/>
<xsl:for-each select="body/section">
<item>
<xsl:attribute name="href">chapitres/chapitre<xsl:number level="multiple" count="section" format="1"/>.xhtml</xsl:attribute>
<xsl:attribute name="id">ch<xsl:number level="multiple" count="section" format="1"/></xsl:attribute>
<xsl:attribute name="id">ch_<xsl:number level="multiple" count="section" format="1"/></xsl:attribute>
<xsl:attribute name="media-type">application/xhtml+xml</xsl:attribute>
</item>
</xsl:for-each>
</manifest>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dc="http://www.idpf.org/2007/opf"
xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
exclude-result-prefixes="xs"
xmlns="http://www.idpf.org/2007/opf"
version="2.0">
<xsl:template name="metadata">
<metadata>
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title><xsl:value-of select="head/title"/></dc:title>
<dc:creator><xsl:value-of select="head/meta[@name='author']/@content"/></dc:creator>
<dc:language>fr</dc:language>
<dc:identifier id="BookID">V2.0</dc:identifier>
</metadata>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dc="http://www.idpf.org/2007/opf"
xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
exclude-result-prefixes="xs"
xmlns="http://www.idpf.org/2007/opf"
version="2.0">
<xsl:template name="spine">
<spine toc="tDMncx">
<xsl:for-each select="body/section">
<itemref>
<xsl:attribute name="idref">ch<xsl:number level="multiple" count="section" format="1"/></xsl:attribute>
<xsl:attribute name="idref">ch_<xsl:number level="multiple" count="section" format="1"/></xsl:attribute>
</itemref>
</xsl:for-each>
</spine>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
</xsl:stylesheet>
......@@ -13,7 +13,9 @@
<head>
<meta content="org-example-5059463624137734586" name="dtb:uid"/>
</head>
<docTitle>
<text><xsl:value-of select="head/title"/></text>
</docTitle>
<navMap>
<xsl:apply-templates/>
</navMap>
......
<html>
<head>
<title>page principale</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js" ></script>
<script type="text/javascript">
jQuery("document").ready(function () {
var myData = [{
"title":
"XSLT (oprations avances): expressions rgulires et fichiers texte"
,
"authors":
"Karim El Aktaa (Contributions: Stphane Crozat et les tudiants de NF29)"
,
"keywords":
[
"XSL"
,
"XSLT"
,
"XSL-XSLT"
,
"Expression rgulire"
]
,
"rights":
"by-sa"
,
"introduction":
"XSL-XSLT est un langage de programmation qui permet notamment de manipuler des documents XML. Ce module a pour but de vous apporter des connaissances plus approfondies sur ce langage que vous connaissez dj: l'utilisation de document non XML et d'expressions rgulires."
},
{
"title":
"XSLT (oprations avances): expressions rgulires et fichiers texte"
,
"authors":
"Karim El Aktaa (Contributions: Stphane Crozat et les tudiants de NF29)"
,
"keywords":
[
"XSL"
,
"XSLT"
,
"XSL-XSLT"
,
"Expression rgulire"
]
,
"rights":
"by-sa"
,
"introduction":
"XSL-XSLT est un langage de programmation qui permet notamment de manipuler des documents XML. Ce module a pour but de vous apporter des connaissances plus approfondies sur ce langage que vous connaissez dj: l'utilisation de document non XML et d'expressions rgulires."
}]
for (var item in myData) {
var model = jQuery("div[name='toFill']").first().clone();
model.find("a[name='link']").attr("href", "title.html#" + encodeURI(JSON.stringify(myData[item])));
model.find("span[name='title']").text(myData[item].title);
model.css("display", "block")
model.appendTo(jQuery("body").first());
}
});
</script>
</head>
<body>
<input type="text" id="search" style="width:100%"/>
<div name="toFill" style="display:none;">
<a href="" name="link">
<div style="width:100%; text-align: center; border: solid 1px black; padding: 5px; margin: 3px;">
<span name="title">
</span>
</div>
</a>
</div>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>page secondaire</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js" ></script>
<script type="text/javascript">
jQuery("document").ready(function () {
var myData = JSON.parse(decodeURI(document.location.href.split("#")[1]));
jQuery("#title").text(myData.title);
jQuery("#spData").append("<p>Auteur(s) : " + myData.authors + "</p>");
jQuery("#spData").append("<p>License de droits d'usage : " + myData.rights + "</p>");
jQuery("#spData").append("");
jQuery("#rwData").append("<p>non classs : " + myData.keywords.join(", ") + "</p>");
jQuery("#introduction").text(myData.introduction);
});
function loadFullText() {
jQuery("#preview").empty();
jQuery("#preview").text("TODO");
}
</script>
<style type="text/css">
div {
border: solid 1px black;
}
</style>
</head>
<body>
<div id="toFill">
<h1 id="title"></h1>
<div>
<div style="width: 62%; display:inline-block">
<p id="spData">
</p>
<div style="text-align:center;"><a href="#todo">Lien de tlchargement</a></div>
</div>
<div id="rwData" style="width: 35%; margin-top:0px; float:right;%">
<h2>Tags</h2>
</div>
</div>
<div id="preview" style="clear:both">
<div id="introduction" ></div>
<div style="text-align:center;">
<a href="#" onclick="loadFullText()">Lire plus ...</a>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -6,7 +6,7 @@
<xsl:import href="../xsl-import/string.xsl"/>
<xsl:template name="title-main">
<xsl:choose>
<xsl:when test="../section">
<xsl:when test="name() = 'section'">
<xsl:call-template name="title-section"></xsl:call-template>
</xsl:when>
<xsl:otherwise>
......
/* Font declarations */
@font-face {
font-family: "CMU Serif";
src: url(cmunrm.ttf);
font-weight: normal;
font-style: normal;
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
@font-face {
font-family: "CMU Serif Extra";
src: url(cmunrb.ttf);
font-weight: bold;
font-style: normal;
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
@font-face {
font-family: "CMU Serif";
src: url(cmunti.ttf);
font-weight: normal;
font-style: italic;
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
@font-face {
font-family: "CMU Typewriter Text";
src: url(cmuntt.ttf);
font-weight: normal;
font-style: normal;
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
/* Global page styles */
@page {
size: A4 portrait;
margin: 2cm;
}
* {
font-family: "CMU Serif";
}
......@@ -42,6 +42,10 @@
<echo message="Dirpath : {$dirpath}"/>
<copy file="{$BaseDirectory}/css/main.css" tofile="{$dirpath}/main.css"/>
<copy file="{$BaseDirectory}/font/cmunrm.ttf" tofile="{$dirpath}/cmunrm.ttf"/>
<copy file="{$BaseDirectory}/font/cmunrb.ttf" tofile="{$dirpath}/cmunrb.ttf"/>
<copy file="{$BaseDirectory}/font/cmunti.ttf" tofile="{$dirpath}/cmunti.ttf"/>
<copy file="{$BaseDirectory}/font/cmuntt.ttf" tofile="{$dirpath}/cmuntt.ttf"/>
<xslt in="{$TempDirectory}/{$path}" out="{$dirpath}/hdoc_nsless.xhtml" style="xsl/ns_remover.xsl" classpath="./lib/saxon9he.jar"/>
<xslt in="{$dirpath}/hdoc_nsless.xhtml" out="{$dirpath}/flat_hdoc.xhtml" style="xsl/hdoc_flattenizer.xsl" classpath="./lib/saxon9he.jar"/>
......
......@@ -26,9 +26,10 @@
<head>
<xsl:apply-templates select="node()|@*"/>
<link>
<xsl:attribute name="ref">stylesheet</xsl:attribute>
<xsl:attribute name="rel">stylesheet</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
<xsl:attribute name="href">css/main.css</xsl:attribute>
<xsl:attribute name="href">main.css</xsl:attribute>
<xsl:attribute name="media">print</xsl:attribute>
</link>
</head>
</xsl:template>
......
This diff is collapsed.
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