Commit 2c09fc3a authored by Drain's avatar Drain

Added opale_to_hdoc to the folder

parent d5cae37a
<project name="ProjetOpale" default="convert">
<!-- Arguments properties -->
<property name="InputPath" value="source.scar" />
<property name="OutputPath" value="result.hdoc" />
<!-- Other properties -->
<property name="UnzipSourcePath" value="UnzipSourcePath" />
<property name="XmlModuleName" value="" />
<property name="TmpPath" value="TmpPath" />
<property name="TmpFile1" value="TmpFile1.xml" />
<property name="RacineFile" value="content.xml" />
<property name="HdocPath" value="hdoc" />
<!-- Others properties (in another file) currently empty -->
<property file="opale_to_hdoc.properties" />
<!-- Beginning -->
<target name="convert">
<antcall target="clean" />
<antcall target="unzip_scar" />
<antcall target="check_source_xml" />
<antcall target="hdoc_structure" />
<antcall target="fusion_xml" />
<antcall target="content_xml" />
<antcall target="zip" />
</target>
<!-- Clean : delete old files -->
<target name="clean">
<!-- create folders (to be sure) -->
<mkdir dir="${UnzipSourcePath}"/>
<mkdir dir="${TmpPath}"/>
<mkdir dir="${HdocPath}"/>
<!-- delete folders -->
<delete dir="${UnzipSourcePath}"/>
<delete dir="${TmpPath}"/>
<delete dir="${HdocPath}"/>
</target>
<!-- Check if only one xml file -->
<target name="check_source_xml">
<!-- count xml files -->
<resourcecount property="xml.count">
<fileset dir="${UnzipSourcePath}" casesensitive="yes">
<include name="*.xml"/>
</fileset>
</resourcecount>
<!-- check if only one xml file -->
<condition property="xml.onlyone">
<equals arg1="${xml.count}" arg2="1"/>
</condition>
<!-- fail if more than one -->
<fail message="Error : too many source file (${xml.count}), source file not found or unreadable." unless="xml.onlyone"/>
</target>
<!-- Unzip scar source file -->
<target name="unzip_scar">
<unzip src="${InputPath}" dest="./${UnzipSourcePath}"/>
</target>
<!-- Create the hdoc structure -->
<target name="hdoc_structure">
<mkdir dir="${HdocPath}"/>
<mkdir dir="${HdocPath}/META-INF" />
<touch file="${HdocPath}/META-INF/container.xml" />
<touch file="${HdocPath}/mimetype" />
<echo message="application/x-hdoc+zip" file="${HdocPath}/mimetype" />
<echoxml file="${HdocPath}/META-INF/container.xml">
<container version="1.0">
<rootfiles>
<rootfile full-path="${HdocPath}/${RacineFile}" media-type="text/xml" />
</rootfiles>
</container>
</echoxml>
</target>
<!-- Make a unique xml source file -->
<target name="fusion_xml">
<!-- get xml source file path -->
<fileset id="fileset_source_xml" dir="${UnzipSourcePath}" casesensitive="yes">
<include name="*.xml"/>
</fileset>
<pathconvert property="xml.path" pathsep="" refid="fileset_source_xml" />
<!-- xsl -->
<xslt style="opale_to_hdoc_regle1.xsl" in="${xml.path}" out="./${TmpPath}/${TmpFile1}">
</xslt>
</target>
<!-- Create content.xml -->
<target name="content_xml">
<xslt style="opale_to_hdoc_regle2.xsl" in="./${TmpPath}/${TmpFile1}" out="./${HdocPath}/${RacineFile}" />
</target>
<!-- Zip Hdoc -->
<target name="zip">
<zip destfile="${OutputPath}" basedir="${HdocPath}"/>
</target>
</project>
\ No newline at end of file
@echo off
set lib=lib
set ant=myantce.ant
set antparam=-Dprogram.param=%1
set scJarList=%lib%\*
java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
pause
REM start /MIN java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
#!/bin/sh
lib="lib"
ant="myantce.ant"
antparam="-Dprogram.param=$1"
#Recherche de java et controle que se soit une version SUN
vJavaCmd="java"
xCheckJava () {
vInputVarName=\$"$1"
vInputVarVal=`eval "expr \"$vInputVarName\" "`
if [ -z "$vInputVarVal" ];then
eval "$1=false"
return
fi
vSunJavaFound=`$vInputVarVal -version 2>&1 | grep -Eo -m 1 "(HotSpot)|(OpenJDK)"`
if [ "$vSunJavaFound" != "HotSpot" ] && [ "$vSunJavaFound" != "OpenJDK" ] ; then
eval "$1=false"
return
fi
}
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
vJavaCmd="$JAVA_HOME/bin/java"
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
echo "ERREUR: JRE de SUN introuvable. Veuillez déclarer la variable d'environnement JAVA_HOME."
exit 1
fi
fi
#Lancer la commande
scJarList="$lib/*"
$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam
<?xml version="1.0" encoding="UTF-8"?>
<!-- namespaces ajoutés -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:op="utc.fr:ics/opale3">
<!-- cas d'une activité d'apprentissage (avec contenu externe) -->
<xsl:template match="sp:courseUa[@sc:refUri]">
<!-- se copie soit même -->
<xsl:copy>
<!-- à faire : copier seulement ce qui est dans la balise sc:item du fichier distant -->
<xsl:apply-templates select="document(./@sc:refUri)/sc:item/*"/>
</xsl:copy>
</xsl:template>
<!-- cas d'un grain de contenu (avec contenu externe) -->
<xsl:template match="sp:courseUc[@sc:refUri]">
<!-- se copie soit même -->
<xsl:copy>
<!-- avec comme contenu ce qui se trouve dans la balise sc:item du fichier distant -->
<xsl:apply-templates select="document(./@sc:refUri)/sc:item/*"/>
</xsl:copy>
</xsl:template>
<!-- si j'ai un node de type attribut appelé sc:refUri -->
<!--<xsl:template match="*[@sc:refUri]"> -->
<!-- ne pas recopier l'élement ? -->
<!-- avec comme contenu le fichier distant -->
<!-- <xsl:apply-templates select="document(./@sc:refUri)/*"/> -->
<!--</xsl:template>-->
<!-- pour tous les autres noeuds -->
<!-- les blocs ne peuvent être externalisés -->
<xsl:template match="node()|@*">
<!-- se copie soit même -->
<xsl:copy>
<!-- récursion sur tous les autres noeuds -->
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
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