Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
hdoc
Commits
29e44dd7
Commit
29e44dd7
authored
Jan 05, 2017
by
Aghiles
Browse files
gestion des métadonnées
parent
3ee23c7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
wikipedia_to_hdoc/ant/wiki_to_hdoc_fetcher.ant
View file @
29e44dd7
<?xml version="1.0" encoding="UTF-8"?>
<project
name=
"wikiToHdoc"
default=
"main"
basedir=
".."
>
<!-- wikipediaUrl and destination are the only required parameters -->
...
...
@@ -21,6 +22,7 @@
<antcall
target=
"clean"
/>
<antcall
target=
"prepare"
/>
<antcall
target=
"prepareHdocStructure"
/>
<antcall
target=
"getImgMetadata"
/>
<antcall
target=
"transformWikiToHdoc"
/>
<antcall
target=
"zip"
/>
</target>
...
...
@@ -75,7 +77,29 @@
</echoxml>
<xslt
classpath=
"lib/saxon9he.jar"
in=
"${tmpFolderPath}/containerTmp.xml"
out=
"${tmpHdocResultFolderPath}/META-INF/container.xml"
style=
"${xsltFolderPath}/addNamespaceToContainer.xsl"
/>
</target>
<target
name=
"getImgMetadata"
>
<!-- Preparing the links for the metadata extraction -->
<xslt
classpath=
"lib/saxon9he.jar"
in=
"${tmpFolderPath}/${filename}_prepared.xml"
out=
"${hdocResultPath}/img_metadata_link.xml"
style=
"${xsltFolderPath}/prepare_img_link_metadata.xsl"
>
<factory
name=
"net.sf.saxon.TransformerFactoryImpl"
/>
</xslt>
<xmlproperty
file=
"${hdocResultPath}/img_metadata_link.xml"
prefix=
"TEST"
/>
<taskdef
resource=
"net/sf/antcontrib/antlib.xml"
>
<classpath>
<pathelement
location=
"/usr/share/java/lib/ant-contrib-version.jar"
/>
</classpath>
</taskdef>
<for
list=
"${TEST.images.image.link}"
param=
"file"
>
<sequential>
<!-- <loadresource encoding="UTF-8" property="myURL">
<url url="@{file}"/>
</loadresource>
<echo file="${hdocResultPath}/@{file}/test.xml" encoding="UTF-8">${myURL}</echo> -->
<echo>
@{file}
</echo>
</sequential>
</for>
</target>
<target
name=
"transformWikiToHdoc"
>
<!-- Applying wikipedia -> hdoc -->
<xslt
classpath=
"lib/saxon9he.jar"
in=
"${tmpFolderPath}/${filename}_prepared.xml"
out=
"${hdocResultPath}/${filename}.html"
style=
"${xsltFolderPath}/wiki_to_hdoc.xsl"
>
...
...
wikipedia_to_hdoc/xslt/prepare_img_link_metadata.xsl
0 → 100644
View file @
29e44dd7
<?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"
exclude-result-prefixes=
"xs"
version=
"2.0"
>
<xsl:output
encoding=
"UTF-8"
/>
<xsl:template
match=
"html"
>
<images>
<xsl:apply-templates
select=
".//a[img]"
/>
</images>
</xsl:template>
<xsl:template
match=
"a[img]"
>
<image>
<link>
<xsl:text>
https://fr.wikipedia.org
</xsl:text><xsl:value-of
select=
"@href"
/>
</link>
<ref>
<xsl:value-of
select=
"./img/@src"
/>
</ref>
</image>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment