Commit e0844396 authored by lhommeni's avatar lhommeni

Gestion plus fine des listins, suppression de java

parent d8b5e071
*/input/
*/tmp/
*/output/
\ No newline at end of file
*/output/
*/result/
\ No newline at end of file
......@@ -9,15 +9,13 @@
<!-- tmp paths (removed at the end of the process) -->
<property name="tmpFolderPath" value="${basedir}/tmp"/>
<property name="tmpHdocResultFolderPath" value="${tmpFolderPath}/hdoc"/>
<property name="in" location="${basedir}/input"/>
<property name="in" value="${basedir}/input"/>
<property name="resultFolderPath" value="${basedir}/result"/>
<property name="xsltFolderPath" value="${basedir}/xslt"/>
<property name="hdocResultPath" value="${resultFolderPath}/${filename}"/>
<property name="inputFile" value="${hdocResultPath}/${filename}.xml"/>
<!--<property name="inputFile" value="${hdocResultPath}/${filename}.xml"/>-->
<property name="inputFile" value="${in}/${filename}.xml"/>
<!-- Main target -->
<target name="main">
<antcall target="prepare"/>
......@@ -32,11 +30,15 @@
<mkdir dir="${tmpHdocResultFolderPath}"/>
<mkdir dir="${hdocResultPath}"/>
<!-- Fetching html from wikipedia -->
<!-- Fetching html from wikipedia
<java fork="true" failonerror="true" jar="${basedir}/javaSources/FetchWikipediaXml.jar">
<arg value="${wikipediaUrl}"/>
<arg value="${filename}"/>
</java>
</java>-->
<loadresource encoding="UTF-8" property="myURL">
<url url="${wikipediaUrl}"/>
</loadresource>
<echo file="${inputFile}" encoding="UTF-8">${myURL}</echo>
<!-- Making tmp xml wikipedia file without some elements which are not useful -->
<xslt classpath="lib/saxon9he.jar" in="${inputFile}" out="${tmpFolderPath}/${filename}_prepared.xml" style="${xsltFolderPath}/prepare_wiki_to_hdoc.xsl">
......@@ -83,6 +85,6 @@
<!-- Delete tmp directory -->
<target name="clean">
<delete dir="${tmpFolderPath}"/>
<!-- <delete dir="${tmpFolderPath}"/>-->
</target>
</project>
......@@ -51,7 +51,7 @@
<xslt
in="${toString:first}"
out="${tmpdir}/generateContentPath.xml"
style="xsl/transformation0.xsl"
style="transformation0.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
/>
<chmod file="${tmpdir}/generateContentPath.xml" perm="777"/>
......
......@@ -21,25 +21,28 @@
<!-- This is the main target : it is called whether by the project (as the default target) or by the user/converter
website, if specified in the command line. Basically, this target consists in several targets/ant buildfiles calls. -->
<antcall target="CleanDirectory"/>
<mkdir dir="${tmp}"/>
<antcall target="UnzipHdocFile"/>
<antcall target="ValidateInput" />
<!--<antcall target="ValidateInput" />-->
<antcall target="FindContentFiles"/>
<ant antfile="${tmp}/generateContentPath.xml"/>
<antcall target="ValidateOutput"/>
<!--<antcall target="ValidateOutput"/>-->
<antcall target="DivideOutput"/>
<antcall target="ZipOutput"/>
<antcall target="ZipDividedOutput"/>
<antcall target="CleanDirectory"/>
<!-- <antcall target="CleanDirectory"/>-->
</target>
<target name="CleanDirectory">
<delete dir="${tmp}"/>
<delete>
<fileset dir="${tmp}">
<include name="**/*"/>
</fileset>
</delete>
</target>
<target name="UnzipHdocFile">
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
name="copy-references"
default="main">
<property file="global.properties"/>
<target name="main">
<mkdir dir="${tmpdir}/decompressedOpale/references"/>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://scenari.utc.fr/hdoc/schemas/container/hdoc1-container.rng" type="xml"?>
<container xmlns="urn:utc.fr:ics:hdoc:container" version="1.0">
<rootfiles>
<rootfile full-path="content.xml" media-type="text/xml"/>
</rootfiles>
</container>
<?xml version="1.0" encoding="UTF-8"?><?oxygen RNGSchema="http://scenari.utc.fr/hdoc/schemas/xhtml/hdoc1-xhtml.rng" type="xml"?>
<html xmlns:functx="http://www.functx.com" xmlns="http://www.utc.fr/ics/hdoc/xhtml">
<head>
<title>Constructeur — Wikipédia</title>
<meta charset="utf-8"></meta>
<meta name="generator" content="HdocConverter/wikipedia"></meta>
<meta name="author" content="Wikipedia"></meta>
</head>
<body>
<section data-hdoc-type="introduction">
<header>
<h1>Introduction</h1>
</header>
<div>
<p>Le mot
<em>constructeur</em> peut avoir plusieurs significations :
</p>
</div>
</section>
</body>
</html>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">MaClasse obj;
...
obj = new MaClasse(5, "bonjour");</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">String[] arguments = new String[10];
// ou bien :
int[][] uneMatrice = new int[4][5];
// ou encore :
int[][] quatreLignes = new int[4][];</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">class Object
{
public :
Object (); // Constructeur par défaut
Object (int n) : nombre(n){}; // Constructeur paramétrique
Object (const Object&amp;); // Constructeur par recopie
~Object (); // Destructeur
int nombre;
};
int main ()
{
Object obj, *p_obj; // Appel du constructeur par défaut pour obj
p_obj=new Object(27); // Appel du constructeur paramétrique pour créer un objet pour p_obj
Object obj2(obj); // Appel du constructeur par recopie pour obj2
delete p_obj; // Appel du destructeur pour détruire l'objet contenu dans p_obj
} // Appel du destructeur pour obj et obj2</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">public class MaClasse
{
private int a;
private string b;
// Constructeur
public MaClasse() : this(42, "string")
{
}
// Surcharge d'un constructeur
public MaClasse(int a, string b)
{
this.a = a;
this.b = b;
}
}</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">// Instanciation d'un objet à l'aide du constructeur
MaClasse c = new MyClass(42, "string");</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">public class MaClasse
{
private static int _A;
// Constructeur statique
static MaClasse()
{
_A = 32;
}
// Constructeur standard
public MaClasse()
{
}
}</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<sc:code mimeType="text/plain">// Instanciation d'un objet à l'aide du constructeur
// juste avant l'instanciation
// Le constructeur statique est exécuté, _A prend la valeur 32
MaClasse c = new MaClasse();</sc:code>
</op:code>
</sc:item>
\ No newline at end of file
application/x-hdoc+zip
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<wspType defaultCode="Opale" title="Opale Advanced 3.5 (fr-FR)" description="" uri="Opale3-5_fr-FR_005" key="Opale3-5" lang="fr-FR" version="3.5.005"><wspUpdate localAutoUpdate="minor"><res key="Opale3-5.wsp"/></wspUpdate><systemSpace space="~param/Opale3-5/ss"><res key="Opale3-5.ss"/></systemSpace><systemSpace space="~param/Opale3-5/bs" optional="true"><res key="Opale3-5.bs"/></systemSpace><systemSpace space="~param/Opale3-5/gen/web"><res key="Opale3-5.gen.web"/></systemSpace><systemSpace space="~param/Opale3-5/gen/scormMono"><res key="Opale3-5.gen.scormMono"/></systemSpace><systemSpace space="~param/Opale3-5/gen/scormMulti"><res key="Opale3-5.gen.scormMulti"/></systemSpace><systemSpace space="~param/Opale3-5/gen/paper"><res key="Opale3-5.gen.paper"/></systemSpace><systemSpace space="~param/Opale3-5/gen/pres"><res key="Opale3-5.gen.pres"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewPresShort"><res key="Opale3-5.gen.previewPresShort"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewPresStandard"><res key="Opale3-5.gen.previewPresStandard"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebStandard"><res key="Opale3-5.gen.previewWebStandard"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebShort"><res key="Opale3-5.gen.previewWebShort"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebStandardComments"><res key="Opale3-5.gen.previewWebStandardComments"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebShortComments"><res key="Opale3-5.gen.previewWebShortComments"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packScorm12"><res key="Opale3-5.gen.packScorm12"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packScorm2k4"><res key="Opale3-5.gen.packScorm2k4"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packClaroline"><res key="Opale3-5.gen.packClaroline"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packGanesha"><res key="Opale3-5.gen.packGanesha"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packMoodle"><res key="Opale3-5.gen.packMoodle"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packSyfadis"><res key="Opale3-5.gen.packSyfadis"/></systemSpace><editionSheet pack="Opale3-5_fr-FR_005" brickSelector="{Opale3-5.moz;3.5.005;fr-FR}"/></wspType>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<op:ue>
<op:ueM>
<sp:title>Constructeur — Wikipédia</sp:title>
<sp:info>
<op:info>
<sp:keywds>
<op:keywds/>
</sp:keywds>
<sp:cpyrgt>
<op:sPara>
<sc:para>Wikipedia</sc:para>
</op:sPara>
</sp:cpyrgt>
</op:info>
</sp:info>
</op:ueM>
<sp:intro>
<op:res>
<sp:txt>
<op:txt>
<sc:para>Le mot
<sc:inlineStyle role="emp">constructeur</sc:inlineStyle> peut avoir plusieurs significations :
</sc:para>
</op:txt>
</sp:txt>
</op:res>
</sp:intro>
</op:ue>
</sc:item>
<?xml version="1.0" encoding="UTF-8" ?>
<wspType defaultCode="Opale" title="Opale Advanced 3.5 (fr-FR)" description="" uri="Opale3-5_fr-FR_005" key="Opale3-5" lang="fr-FR" version="3.5.005"><wspUpdate localAutoUpdate="minor"><res key="Opale3-5.wsp"/></wspUpdate><systemSpace space="~param/Opale3-5/ss"><res key="Opale3-5.ss"/></systemSpace><systemSpace space="~param/Opale3-5/bs" optional="true"><res key="Opale3-5.bs"/></systemSpace><systemSpace space="~param/Opale3-5/gen/web"><res key="Opale3-5.gen.web"/></systemSpace><systemSpace space="~param/Opale3-5/gen/scormMono"><res key="Opale3-5.gen.scormMono"/></systemSpace><systemSpace space="~param/Opale3-5/gen/scormMulti"><res key="Opale3-5.gen.scormMulti"/></systemSpace><systemSpace space="~param/Opale3-5/gen/paper"><res key="Opale3-5.gen.paper"/></systemSpace><systemSpace space="~param/Opale3-5/gen/pres"><res key="Opale3-5.gen.pres"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewPresShort"><res key="Opale3-5.gen.previewPresShort"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewPresStandard"><res key="Opale3-5.gen.previewPresStandard"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebStandard"><res key="Opale3-5.gen.previewWebStandard"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebShort"><res key="Opale3-5.gen.previewWebShort"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebStandardComments"><res key="Opale3-5.gen.previewWebStandardComments"/></systemSpace><systemSpace space="~param/Opale3-5/gen/previewWebShortComments"><res key="Opale3-5.gen.previewWebShortComments"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packScorm12"><res key="Opale3-5.gen.packScorm12"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packScorm2k4"><res key="Opale3-5.gen.packScorm2k4"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packClaroline"><res key="Opale3-5.gen.packClaroline"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packGanesha"><res key="Opale3-5.gen.packGanesha"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packMoodle"><res key="Opale3-5.gen.packMoodle"/></systemSpace><systemSpace space="~param/Opale3-5/gen/packSyfadis"><res key="Opale3-5.gen.packSyfadis"/></systemSpace><editionSheet pack="Opale3-5_fr-FR_005" brickSelector="{Opale3-5.moz;3.5.005;fr-FR}"/></wspType>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<op:ue>
<op:ueM>
<sp:title>Constructeur — Wikipédia</sp:title>
<sp:info>
<op:info>
<sp:keywds>
<op:keywds/>
</sp:keywds>
<sp:cpyrgt>
<op:sPara>
<sc:para>Wikipedia</sc:para>
</op:sPara>
</sp:cpyrgt>
</op:info>
</sp:info>
</op:ueM>
<sp:intro>
<op:res>
<sp:txt>
<op:txt>
<sc:para>Le mot
<sc:inlineStyle role="emp">constructeur</sc:inlineStyle> peut avoir plusieurs significations :
</sc:para>
</op:txt>
</sp:txt>
</op:res>
</sp:intro>
</op:ue>
</sc:item>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
name="copy-ucs"
basedir=".."
default="main">
<property name="in" location="${basedir}/input"/>
<property name="out" location="${basedir}/output"/>
<property name="tmp" location="${basedir}/tmp"/>
<property name="xsl" location="${basedir}/xsl"/>
<property name="lib" location="${basedir}/lib"/>
<property name="log" location="${basedir}/log"/>
<property name="schema" location="${basedir}/schema"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="./lib/jing.jar"/>
</classpath>
</taskdef>
<property file="global.properties"/>
<target name="main"/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:c="urn:utc.fr:ics:hdoc:container"
name="getContentFileAndTransformIt"
basedir=".."
default="start">
<property file="global.properties"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="./lib/jing.jar"/>
</classpath>
</taskdef>
<target name="start">
<jing file="${tmp}/decompressedHdoc/content.xml"
rngfile="${schema}/hdoc1-xhtml.rng"/>
<xslt in="${tmp}/decompressedHdoc/content.xml"
out="${tmp}/moveRessourceFiles.xml"
style="${xsl}/moveRessourceFiles.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"/>
<chmod file="${tmp}/moveRessourceFiles.xml" perm="777"/>
<xslt in="${tmp}/decompressedHdoc/content.xml"
out="${tmp}/decompressedOpale/main.xml"
style="${xsl}/transformation2.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"/>
<chmod file="${tmp}/decompressedOpale/main.xml" perm="777"/>
<xslt in="${tmp}/decompressedHdoc/content.xml"
out="${tmp}/convertReferences.xml"
style="${xsl}/prepareReferencesConversions.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"/>
<ant antfile="${tmp}/convertReferences.xml"/>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
name="moveRessourceFiles"
basedir="."
default="moveRessourceFiles">
<property file="global.properties"/>
<target name="moveRessourceFiles"/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<op:ue>
<op:ueM>
<sp:title>Constructeur — Wikipédia</sp:title>
<sp:info>
<op:info>
<sp:keywds>
<op:keywds/>
</sp:keywds>
<sp:cpyrgt>
<op:sPara>
<sc:para>Wikipedia</sc:para>
</op:sPara>
</sp:cpyrgt>
</op:info>
</sp:info>
</op:ueM>
<sp:intro>
<op:res>
<sp:txt>
<op:txt>
<sc:para>Le mot
<sc:inlineStyle role="emp">constructeur</sc:inlineStyle> peut avoir plusieurs significations :
</sc:para>
</op:txt>
</sp:txt>
</op:res>
</sp:intro>
</op:ue>
</sc:item>
......@@ -42,7 +42,7 @@
<param name="elementid" expression="{@data-export-id}"/>
</xslt>
<jing file="${{tmp}}/decompressedOpaleDivided/{@data-export-file}" rngfile="${{schema}}/op_expUc.rng"></jing>
<!-- <jing file="${{tmp}}/decompressedOpaleDivided/{@data-export-file}" rngfile="${{schema}}/op_expUc.rng"></jing>-->
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
>
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
......@@ -568,6 +570,34 @@
<op:resInfoM/>
</sp:res>
</xsl:template>
<!-- Listing -->
<xsl:param name="text-encoding" as="xs:string" select="'iso-8859-1'"/>
<xsl:param name="text-uri" as="xs:string" select="res/listing/listing1.txt"/>
<xsl:template match="h:object[@type='application/pdf']" priority="1">
<sp:listing>
<xsl:copy-of select="document(fn:concat('../tmp/decompressedHdoc/',@data))/sc:item/op:code"/>
</sp:listing>
<!-- <sp:listing>
<sc:item>
<op:code>
<sc:code mimeType="text/x-csrc"><xsl:copy-of select="unparsed-text(fn:concat('../tmp/decompressedHdoc/',@data))"/></sc:code>
</op:code>
</sc:item>-->
<!--<op:code>
<sc:code mimeType="text/plain">
<xsl:copy-of select="unparsed-text(fn:concat('../tmp/decompressedHdoc/',@data))"/>
</sc:code>
</op:code>-->
<!-- -->
</xsl:template>
<xsl:template match="h:object">
<sp:int sc:refUri="res/{./@data}">
<op:instructionM/>
......
<?xml version="1.0" encoding="UTF-8"?><?oxygen RNGSchema="http://scenari.utc.fr/hdoc/schemas/xhtml/hdoc1-xhtml.rng" type="xml"?>
<html xmlns="http://www.utc.fr/ics/hdoc/xhtml">
<html xmlns:functx="http://www.functx.com" xmlns="http://www.utc.fr/ics/hdoc/xhtml">
<head>
<title>Constructeur (programmation) — Wikipédia</title>
<meta charset="utf-8"></meta>
......@@ -46,12 +46,12 @@
<p>Pour créer un nouvel objet, le mot-clé
<i>new</i> doit être suivi d'une méthode qui soit un constructeur. Par exemple, on pourra avoir :
</p>
<object type="application/pdf" data="listing/listing1.txt"></object>
<object type="application/pdf" data="listing/listing1.xml"></object>
<p>si toutefois la classe
<i>MaClasse</i> a un constructeur qui possède deux paramètres : un entier et une chaîne de caractères.
</p>
<p>Pour créer un nouveau tableau, on peut par exemple écrire :</p>
<object type="application/pdf" data="listing/listing2.txt"></object>
<object type="application/pdf" data="listing/listing2.xml"></object>
</div>
</section>
<section>
......@@ -65,7 +65,7 @@
du mot-clé
<i>new</i>. Le constructeur peut utiliser la syntaxe constructeur(argument) : variable(argument) pour initialiser les variables.
</p>
<object type="application/pdf" data="listing/listing3.txt"></object>
<object type="application/pdf" data="listing/listing3.xml"></object>
</div>
</section>
<section>
......@@ -76,8 +76,8 @@
<p>Exemple de constructeur en
<a href="http://wikipedia.org/wiki/C_sharp">C#</a> :
</p>
<object type="application/pdf" data="listing/listing4.txt"></object>
<object type="application/pdf" data="listing/listing5.txt"></object>
<object type="application/pdf" data="listing/listing4.xml"></object>
<object type="application/pdf" data="listing/listing5.xml"></object>
<p>Il existe par ailleurs en C# des
<a href="http://wikipedia.orghttp://msdn.microsoft.com/fr-fr/library/k9x6w0hc.aspx">constructeurs statiques</a>, qui permettent d'initialiser une donnée statique et d'effectuer une action particulière
devant être effectuée une seule fois. Les constructeurs statiques sont appelés implicitement
......@@ -85,8 +85,8 @@
déclenche l'exécution du constructeur statique.
</p>
<p>Exemple d'utilisation d'un constructeur statique :</p>
<object type="application/pdf" data="listing/listing6.txt"></object>
<object type="application/pdf" data="listing/listing7.txt"></object>
<object type="application/pdf" data="listing/listing6.xml"></object>
<object type="application/pdf" data="listing/listing7.xml"></object>
</div>
</section>
<section>
......
<?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:functx="http://www.functx.com"
exclude-result-prefixes="xs"
version="2.0"
xmlns="http://www.utc.fr/ics/hdoc/xhtml">
<xsl:output method="xhtml" indent="yes"/>
<xsl:preserve-space elements="pre"/>
<xsl:template match="*"/>
<xsl:template match="text()">
<xsl:value-of select="."/>
......@@ -239,23 +241,65 @@
<xsl:value-of select="."/>
</xsl:template>
<!-- Listing -->
<!-- Handle Listing -->
<xsl:template match="div[@class='mw-highlight mw-content-ltr']" mode="textOnly">
<xsl:apply-templates select="pre" mode="textOnly"/>
</xsl:template>
<xsl:template match="pre" mode="textOnly">
<xsl:variable name="vUid">
<xsl:number level="any" count="pre"/>
</xsl:variable>
<object type="application/pdf" data="listing/listing{$vUid}.txt"> <!--Modifier le application/pdf lorsque le rng sera changé-->
<xsl:result-document href="listing/listing{$vUid}.txt" method="text">
<xsl:copy-of select="@*|node()"></xsl:copy-of>
<xsl:variable name="listingContent">
<xsl:copy-of select="@*|node()"/>
</xsl:variable>
<xsl:variable name="listingContentWithoutBadCharacters">
<xsl:copy-of select="replace($listingContent,'&amp;','&amp;amp;')"/>
</xsl:variable>
<xsl:variable name="listingContent2">
<xsl:value-of select="substring-after($listingContentWithoutBadCharacters,'&#10;')"/>
</xsl:variable>
<xsl:variable name="basename">
<xsl:call-template name="substring-before-last">
<xsl:with-param name="string1" select="$listingContent2" />
<xsl:with-param name="string2" select="'&#10;'" />
</xsl:call-template>
</xsl:variable>
<object type="application/pdf" data="listing/listing{$vUid}.xml"> <!--Modifier le application/pdf lorsque le rng sera changé-->
<xsl:result-document href="listing/listing{$vUid}.xml" method="text">
<xsl:text disable-output-escaping="no">
&lt;sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"&gt;
&lt;op:code xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3"&gt;
&lt;sc:code mimeType="text/plain"&gt;</xsl:text>
<xsl:value-of select="$basename"/>
<xsl:text disable-output-escaping="no">&lt;/sc:code&gt;
&lt;/op:code&gt;
&lt;/sc:item&gt;
</xsl:text>
</xsl:result-document>
</object>
</xsl:template>
<xsl:template name="substring-before-last">
<xsl:param name="string1" select="''" />
<xsl:param name="string2" select="''" />
<xsl:if test="$string1 != '' and $string2 != ''">
<xsl:variable name="head" select="substring-before($string1, $string2)" />
<xsl:variable name="tail" select="substring-after($string1, $string2)" />
<xsl:value-of select="$head" />
<xsl:if test="contains($tail, $string2)">
<xsl:value-of select="$string2" />
<xsl:call-template name="substring-before-last">
<xsl:with-param name="string1" select="$tail" />
<xsl:with-param name="string2" select="$string2" />
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="span" mode="textOnly">
......
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