Commit f01dcfa0 authored by Benoit Villain's avatar Benoit Villain

hdoc_to_canoprof V0 : Transforme un hdoc en un programme titré Canoprof sans rien d autres.

parent 27fe74a7
<?xml version="1.0" encoding="UTF-8" ?>
<wspType defaultCode="canoprof" title="Canoprof Standard 1.0 (fr-FR)" description="" uri="canoprof1-0_fr-FR_106" key="canoprof1-0" lang="fr-FR" version="1.0.106"><wspUpdate localAutoUpdate="minor"><res key="canoprof1-0.wsp"/></wspUpdate><systemSpace space="~param/canoprof1-0/ss"><res key="canoprof1-0.ss"/></systemSpace><systemSpace space="~param/canoprof1-0/bs" optional="true"><res key="canoprof1-0.bs"/></systemSpace><systemSpace space="~param/canoprof1-0/gen/web"><res key="canoprof1-0.gen.web"/></systemSpace><systemSpace space="~param/canoprof1-0/gen/print"><res key="canoprof1-0.gen.print"/></systemSpace><systemSpace space="~param/canoprof1-0/gen/webPre"><res key="canoprof1-0.gen.webPre"/></systemSpace><systemSpace space="~param/canoprof1-0/gen/webProps"><res key="canoprof1-0.gen.webProps"/></systemSpace><systemSpace space="~param/canoprof1-0/gen/printProps"><res key="canoprof1-0.gen.printProps"/></systemSpace><systemSpace space="~param/canoprof1-0/gen/control"><res key="canoprof1-0.gen.control"/></systemSpace><systemSpace space="~param/canoprof1-0/gen/scorm2k4"><res key="canoprof1-0.gen.scorm2k4"/></systemSpace><systemSpace space="~param/canoprof1-0/gen/scorm12"><res key="canoprof1-0.gen.scorm12"/></systemSpace><systemSpace space="~param/canoprof1-0/gen/activityPre"><res key="canoprof1-0.gen.activityPre"/></systemSpace><editionSheet pack="canoprof1-0_fr-FR_106" brickSelector="{canoprof1-0.moz;1.0.106;fr-FR}"/></wspType>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<wspOrigin wspCode="Standard" timestamp="1480536411731"><root srcUri="/Test"/></wspOrigin>
\ 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"?>
<project basedir=".." name="main" default="convert">
<property name="InputPath" value="bib2.bib"></property>
<property name="OutputPath" value="${basedir}\result\ref.scar"></property>
<property name="lib" value="${basedir}/lib"/>
<target name="convert">
<antcall target="preparation"/>
<antcall target="BibtexToBibXml"/>
<antcall target="BibXmlToHdocBib"/>
<antcall target="HdocToOpale"/>
<antcall target="zip"/>
<antcall target="CleanDirectory"/>
</target>
<target name="convertfrombibxml">
<antcall target="preparation"/>
<antcall target="HdocToOpale"/>
<antcall target="zip"/>
<antcall target="CleanDirectory"/>
</target>
<target name="preparation">
<delete dir="${basedir}/result"></delete>
<mkdir dir="${basedir}/result"></mkdir>
<mkdir dir="${basedir}/decompressedOpale"></mkdir>
<mkdir dir="${basedir}/decompressedOpale/ref"></mkdir>
<mkdir dir="${basedir}/tmp"></mkdir>
</target>
<target name="CleanDirectory">
<delete dir="${basedir}/tmp"></delete>
<delete dir="${basedir}/java"></delete>
<delete dir="${basedir}/decompressedOpale"></delete>
</target>
<target name="BibtexToBibXml">
<!-- Convert Bibtex into BibtexXml -->
<java
fork="true"
failonerror="true"
jar="${lib}/bibtex.jar"
>
<arg value="${InputPath}"/>
<arg value="${basedir}/tmp"/>
<arg value="/tmpBibXml.xml"/>
</java>
</target>
<target name="BibXmlToHdocBib">
<!-- Convert from BibXlm to HdocBib -->
<xslt classpath="${basedir}/${lib}/saxon9he.jar"
in="${basedir}\tmp\tmpBibXml.xml" out="${basedir}\tmp\tmpHdocBib.xml"
xslresource="${basedir}/XSL/BibToHdoc.xsl"></xslt>
</target>
<target name="HdocToOpale">
<!-- Convert from HdocBib to Opale -->
<xslt in="${basedir}\tmp\tmpHdocBib.xml"
out="${basedir}/tmp/tempHdoc.xml"
xslresource="${basedir}/XSL/SeparateXmlt.xsl">
<param name="in" expression="${basedir}\tmp\tmpHdocBib.xml"></param>
<param name="out" expression="${basedir}\decompressedOpale\ref"></param>
</xslt>
<ant antfile="${basedir}/tmp/tempHdoc.xml"/>
</target>
<target name="zip">
<chmod dir="${basedir}/decompressedOpale" perm="777"></chmod>
<copy file=".wspmeta" todir="${basedir}/decompressedOpale"/>
<zip basedir="decompressedOpale" destfile="${OutputPath}" encoding="UTF-8"/>
<chmod dir="${OutputPath}" perm="777"/>
</target>
</project>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- This sheet replaces the url of a namespace where needed -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oldmods="http://bibtexml.sf.net/"
xmlns:myns="http://www.utc.fr/ics/hdoc/bibtexXm">
<xsl:template match="node()|@*" priority="3">
<xsl:copy>
<xsl:apply-templates select="node()|@*">
</xsl:apply-templates></xsl:copy>
</xsl:template>
<xsl:template match="
oldmods:file | oldmods:entry |
oldmods:entry/oldmods:article | oldmods:entry/oldmods:book | oldmods:entry/oldmods:booklet | oldmods:entry/oldmods:conference |
oldmods:entry/oldmods:manual | oldmods:entry/oldmods:techreport | oldmods:entry/oldmods:mastersthesis |
oldmods:entry/oldmods:phdthesis | oldmods:entry/oldmods:inbook | oldmods:entry/oldmods:incollection |
oldmods:entry/oldmods:proceedings | oldmods:entry/oldmods:unpublished | oldmods:entry/oldmods:misc |
oldmods:article/oldmods:title | oldmods:article/oldmods:author | oldmods:article/oldmods:journal |
oldmods:article/oldmods:volume | oldmods:article/oldmods:number | oldmods:article/oldmods:pages |
oldmods:book/oldmods:author | oldmods:book/oldmods:editor | oldmods:book/oldmods:title |
oldmods:book/oldmods:publisher | oldmods:book/oldmods:volume | oldmods:book/oldmods:number |
oldmods:book/oldmods:series | oldmods:book/oldmods:address | oldmods:book/oldmods:edition |
oldmods:booklet/oldmods:title | oldmods:booklet/oldmods:author | oldmods:booklet/oldmods:howpublished |
oldmods:booklet/oldmods:address | oldmods:booklet/oldmods:key | oldmods:booklet/oldmods:howpublished |
oldmods:book/oldmods:adress | oldmods:book/oldmods:month | oldmods:book/oldmods:year |
oldmods:inbook/oldmods:chapter | oldmods:inbook/oldmods:pages | oldmods:inbook/oldmods:publisher |
oldmods:inbook/oldmods:series | oldmods:inbook/oldmods:type | oldmods:inbook/oldmods:address |
oldmods:inbook/oldmods:edition |
oldmods:manual/oldmods:title | oldmods:manual/oldmods:author | oldmods:manual/oldmods:editor | oldmods:manual/oldmods:volume |
oldmods:manual/oldmods:number | oldmods:manual/oldmods:series | oldmods:manual/oldmods:pages | oldmods:manual/oldmods:organization |
oldmods:manual/oldmods:address | oldmods:manual/oldmods:edition | oldmods:manual/oldmods:key |
oldmods:techreport/oldmods:author | oldmods:techreport/oldmods:title | oldmods:techreport/oldmods:institution |
oldmods:techreport/oldmods:type | oldmods:techreport/oldmods:number | oldmods:techreport/oldmods:address |
oldmods:techreport/oldmods:key |
oldmods:mastersthesis/oldmods:author | oldmods:mastersthesis/oldmods:title |
oldmods:mastersthesis/oldmods:school | oldmods:mastersthesis/oldmods:year | oldmods:mastersthesis/oldmods:type |
oldmods:mastersthesis/oldmods:address | oldmods:mastersthesis/oldmods:key |
oldmods:phdthesis/oldmods:author | oldmods:phdthesis/oldmods:title |
oldmods:phdthesis/oldmods:school | oldmods:phdthesis/oldmods:year | oldmods:phdthesis/oldmods:type |
oldmods:phdthesis/oldmods:address | oldmods:phdthesis/oldmods:key |
oldmods:inbook/oldmods:author | oldmods:inbook/oldmods:editor | oldmods:inbook/oldmods:title |
oldmods:inbook/oldmods:chapter | oldmods:inbook/oldmods:pages | oldmods:inbook/oldmods:publisher |
oldmods:inbook/oldmods:volume | oldmods:inbook/oldmods:number | oldmods:inbook/oldmods:series |
oldmods:inbook/oldmods:type | oldmods:inbook/oldmods:address | oldmods:inbook/oldmods:edition | oldmods:inbook/oldmods:key |
oldmods:incollection/oldmods:author | oldmods:incollection/oldmods:title | oldmods:incollection/oldmods:booktitle |
oldmods:incollection/oldmods:publisher | oldmods:incollection/oldmods:editor | oldmods:incollection/oldmods:volume |
oldmods:incollection/oldmods:number | oldmods:incollection/oldmods:series | oldmods:incollection/oldmods:type |
oldmods:incollection/oldmods:chapter | oldmods:incollection/oldmods:pages | oldmods:incollection/oldmods:address |
oldmods:incollection/oldmods:edition | oldmods:incollection/oldmods:key |
oldmods:proceedings/oldmods:title | oldmods:proceedings/oldmods:year | oldmods:proceedings/oldmods:editor |
oldmods:proceedings/oldmods:volume | oldmods:proceedings/oldmods:number | oldmods:proceedings/oldmods:series |
oldmods:proceedings/oldmods:address | oldmods:proceedings/oldmods:publisher | oldmods:proceedings/oldmods:organization |
oldmods:proceedings/oldmods:key |
oldmods:unpublished/oldmods:author | oldmods:unpublished/oldmods:title | oldmods:unpublished/oldmods:howpublished |
oldmods:unpublished/oldmods:key |
oldmods:misc/oldmods:author | oldmods:misc/oldmods:title | oldmods:misc/oldmods:howpublished |
oldmods:misc/oldmods:key |
oldmods:conference/oldmods:author | oldmods:conference/oldmods:title | oldmods:conference/oldmods:booktitle |
oldmods:conference/oldmods:editor | oldmods:conference/oldmods:volume | oldmods:conference/oldmods:number |
oldmods:conference/oldmods:series | oldmods:conference/oldmods:pages | oldmods:conference/oldmods:address |
oldmods:conference/oldmods:organization | oldmods:conference/oldmods:publisher | oldmods:conference/oldmods:key |
oldmods:inproceedings/oldmods:author | oldmods:inproceedings/oldmods:title | oldmods:inproceedings/oldmods:booktitle |
oldmods:inproceedings/oldmods:editor | oldmods:inproceedings/oldmods:volume | oldmods:inproceedings/oldmods:number |
oldmods:inproceedings/oldmods:series | oldmods:inproceedings/oldmods:pages | oldmods:inproceedings/oldmods:address |
oldmods:inproceedings/oldmods:organization | oldmods:inproceedings/oldmods:publisher | oldmods:inproceedings/oldmods:key |
*/oldmods:month | */oldmods:year | */oldmods:url" priority="5">
<xsl:element name="myns:{local-name()}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
<xsl:template match="*" priority="4">
<xsl:element name="myns:note">
<xsl:attribute name="type_of"><xsl:value-of select="local-name()"></xsl:value-of></xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="oldmods:metadata"></xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:bib="http://www.utc.fr/ics/hdoc/bibtexXm"
xmlns:op="utc.fr:ics/opale3">
<xsl:output encoding="UTF-8" method="xml" indent="yes"/>
<xsl:param name="Position"/>
<xsl:template match="bib:file">
<xsl:for-each select="bib:entry">
<xsl:if test="position()=$Position">
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<op:bib xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive" xmlns:op="utc.fr:ics/opale3">
<op:bibM>
<sp:id xmlns="http://www.utc.fr/ics/scenari/v3/primitive"><xsl:value-of select="@id"></xsl:value-of></sp:id>
<xsl:if test="child::node()/bib:url = true()"> <sp:type>web</sp:type> </xsl:if>
<xsl:if test="child::node()/bib:url = false()"> <sp:type>bib</sp:type></xsl:if>
<sp:desc>
<op:bibTxt>
<sc:para xml:space="preserve">
<xsl:apply-templates select="child::node()/bib:author"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:year"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:title"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:booktitle"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:editor"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:publisher"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:address"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:edition"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:url"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:journal"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:series"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:volume"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:number"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:chapter"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:pages"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:type"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:institution"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:organization"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:howpulished"></xsl:apply-templates>
<xsl:apply-templates select="child::node()/bib:note"></xsl:apply-templates>
</sc:para>
</op:bibTxt>
</sp:desc>
</op:bibM>
</op:bib>
</sc:item>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="bib:editor | bib:publisher">
<sc:textLeaf role="ed" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"><xsl:value-of select="."/>
<xsl:text> </xsl:text></sc:textLeaf>
</xsl:template>
<xsl:template match="bib:editor[last()] | bib:publisher[last()]">
<sc:textLeaf role="ed" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<xsl:value-of select="."/>
</sc:textLeaf>
</xsl:template>
<xsl:template match="bib:author">
<sc:textLeaf role="auth" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<xsl:value-of select="."/> <xsl:text> </xsl:text>
</sc:textLeaf>
</xsl:template>
<xsl:template match="bib:author[last()]">
<sc:textLeaf role="auth" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<xsl:value-of select="."/>
</sc:textLeaf>
</xsl:template>
<xsl:template match="bib:year">
<sc:textLeaf role="date" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"><xsl:value-of select="../bib:month"/> <xsl:text> </xsl:text><xsl:value-of select="."/></sc:textLeaf>
</xsl:template>
<xsl:template match="bib:title | bib:booktitle">
<sc:textLeaf role="title" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<xsl:value-of select="."/>
</sc:textLeaf>
</xsl:template>
<xsl:template match="bib:url">
<sc:uLink role="url" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<xsl:attribute name="url"> <xsl:value-of select="."/></xsl:attribute>
<xsl:value-of select="."/>
</sc:uLink>
</xsl:template>
<xsl:template match="bib:volume | bib:number">
Volume : <xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:chapter">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:series">
Series : <xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:edition">
Edition : <xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:address">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:journal">
Journal : <xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:pages">
Pages : <xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:type">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:institution">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:organization">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:howpublished">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="bib:note">
Note : <xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:bib="http://www.utc.fr/ics/hdoc/bibtexXm"
xmlns:op="utc.fr:ics/opale3">
<xsl:output encoding="UTF-8" method="xml" indent="yes"/>
<xsl:param name="in"/>
<xsl:param name="out"/>
<xsl:template match="bib:file">
<project basedir=".." name="ref">
<xsl:apply-templates select="bib:entry"></xsl:apply-templates>
</project>
</xsl:template>
<xsl:template match="bib:entry">
<xslt xslresource="./XSL/OneBibXMLToOpaleXml.xsl">
<xsl:attribute name="in"><xsl:value-of select="$in"/></xsl:attribute>
<xsl:attribute name="out"><xsl:value-of select="$out"/>/<xsl:value-of select="./@id"/>.ref</xsl:attribute>
<param name="Position">
<xsl:attribute name="expression"><xsl:value-of select="count(preceding-sibling::bib:entry) + 1"/></xsl:attribute>
</param>
</xslt>
</xsl:template>
<xsl:template match="dc:metadata" xmlns:dc="http://purl.org/dc/elements/1.1/">
</xsl:template>
</xsl:stylesheet>
@article{article,
author = {Peter Adams},
title = {The title of the work},
journal = {The name of the journal},
year = 1993,
number = 2,
pages = {201-213},
month = 7,
note = {An optional note},
volume = 4
}
@book{book,
author = {Peter Babington},
title = {The title of the work},
publisher = {The name of the publisher},
year = 1993,
volume = 4,
series = 10,
address = {The address},
edition = 3,
month = 7,
note = {An optional note},
isbn = {3257227892}
}
@booklet{booklet,
title = {The title of the work},
author = {Peter Caxton},
howpublished = {How it was published},
address = {The address of the publisher},
month = 7,
year = 1993,
note = {An optional note}
}
@conference{conference,
author = {Peter Draper},
title = {The title of the work},
booktitle = {The title of the book},
year = 1993,
editor = {The editor},
volume = 4,
series = 5,
pages = 213,
address = {The address of the publisher},
month = 7,
organization = {The organization},
publisher = {The publisher},
note = {An optional note}
}
@inbook{inbook,
author = {Peter Eston},
title = {The title of the work},
chapter = 8,
pages = {201-213},
publisher = {The name of the publisher},
year = 1993,
volume = 4,
series = 5,
address = {The address of the publisher},
edition = 3,
month = 7,
note = {An optional note}
}
@incollection{incollection,
author = {Peter Farindon},
title = {The title of the work},
booktitle = {The title of the book},
publisher = {The name of the publisher},
year = 1993,
editor = {The editor},
volume = 4,
series = 5,
chapter = 8,
pages = {201-213},
address = {The address of the publisher},
edition = 3,
month = 7,
note = {An optional note}
}
@manual{manual,
title = {The title of the work},
author = {Peter Gainsford},
organization = {The organization},
address = {The address of the publisher},
edition = 3,
month = 7,
year = 1993,
note = {An optional note}
}
@mastersthesis{mastersthesis,
author = {Peter Harwood},
title = {The title of the work},
school = {The school where the thesis was written},
year = 1993,
address = {The address of the publisher},
month = 7,
note = {An optional note}
}
@misc{misc,
author = {Peter Isley},
title = {The title of the work},
howpublished = {How it was published},
month = 7,
year = 1993,
note = {An optional note}
}
@phdthesis{phdthesis,
author = {Peter Joslin},
title = {The title of the work},
school = {The school where the thesis was written},
year = 1993,
address = {The address of the publisher},
month = 7,
note = {An optional note}
}
@proceedings{proceedings,
title = {The title of the work},
year = 1993,
editor = {Peter Kidwelly},
volume = 4,
series = 5,
address = {The address of the publisher},
month = 7,
organization = {The organization},
publisher = {The name of the publisher},
note = {An optional note}
}
@techreport{techreport,
author = {Peter Lambert},
title = {The title of the work},
institution = {The institution that published},
year = 1993,
number = 2,
address = {The address of the publisher},
month = 7,
note = {An optional note}
}
@unpublished{unpublished,
author = {Peter Marcheford},
title = {The title of the work},
note = {An optional note},
month = 7,
year = 1993
}
\ No newline at end of file
tmpdir=tmp
OutputPathDivided=divided.scar
OutputPath=out.scar
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="hdoc_to_canoprof" basedir="." default="convert">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>
<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"/>
<property name="bibtex" location="${basedir}/bibtex_to_canoprof"/>
<property file="global.properties"/>
<target name="convert">
<delete dir="${tmp}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${out}"/>
<delete dir="${log}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${log}"/>
<for param="inputFile">
<path>
<fileset dir="${in}" includes="**/*.hdoc"/>
</path>
<sequential>
<local name="filename"/>
<basename property="filename" file="@{inputFile}"/>
<antcall target="UnzipHdocFile">
<param name="filename" value="${filename}"/>
</antcall>
<antcall target="ValidateInput">
<param name="filename" value="${filename}"/>
</antcall>
<antcall target="FindContentFiles">
<param name="filename" value="${filename}"/>
</antcall>
<ant antfile="${tmp}/${filename}/generateContentPath.xml">
<property name="filename" value="${filename}"/>
</ant>
<antcall target="ZipOutput">
<param name="filename" value="${filename}"/>
</antcall>
</sequential>
</for>
</target>
<target name="UnzipHdocFile">
<!-- Unzip the input hdoc file. Decompressed folder is named "decompressedHdoc" : this name is the only one which
refers to the hdoc file furthermore in this project. -->
<unzip src="${in}/${filename}" dest="${tmp}/${filename}/decompressedHdoc"/>
<chmod dir="${tmp}/${filename}/decompressedHdoc" perm="777"/>
</target>
<target name="FindContentFiles">
<!-- Finds the absolute path of container.xml and applies transformation0.xsl on it.-->
<first id="first">
<fileset dir="${tmp}/${filename}/decompressedHdoc/META-INF" includes="**/container.xml"/>
</first>
<xslt in="${toString:first}" out="${tmp}/${filename}/generateContentPath.xml" style="${xsl}/transformation0.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
<param name="filename" expression="${filename}"/>
<param name="lib" expression="${lib}"/>
</xslt>
<chmod file="${tmp}/${filename}/generateContentPath.xml" perm="777"/>
</target>
<target name="ZipOutput">
<propertyregex property="properFilename" input="${filename}" regexp=".hdoc" replace="" casesensitive="false" override="true" />
<copy file="${bibtex}/.wspmeta" todir="${tmp}/${filename}/decompressedcanoprof"/>
<copy file="${bibtex}/.wsporigin" todir="${tmp}/${filename}/decompressedcanoprof"/>
<mkdir dir="${tmp}/${filename}/decompressedcanoprof/res"/>
<ant antfile="${tmp}/${filename}/moveRessourceFiles.xml"/>
<zip basedir="${tmp}/${filename}/decompressedcanoprof" destfile="${out}/${properFilename}/output.scar" encoding="UTF-8"/>
</target>
<!-- Validating the XML container file -->
<target name="ValidateInput">
<trycatch property="foo" reference="bar">
<try>
<jing file="${tmp}/${filename}/decompressedHdoc/META-INF/container.xml" rngfile="${schema}/hdoc1-container.rng"></jing>
</try>
<catch>
<echo>Validation failed</echo>
</catch>
</trycatch>
</target>
</project>
@echo off
set lib=lib
set ant=hdoc_to_canoprof.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="hdoc_to_canoprof.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/*"