added images inside text for wiki_to_hdoc

parent c173dd22
......@@ -15,21 +15,19 @@
<project name="getRessourcesFiles" basedir="." default="getRessourcesFiles">
<target name="getRessourcesFiles">
<xsl:apply-templates select="//div[@class='thumb tleft' or @class='thumb tright']//img"/>
<xsl:apply-templates select="//img"/>
</target>
</project>
</xsl:template>
<xsl:template match="img" priority="5">
<xsl:param name="dest-rep">${hdocResultPath}/ressources</xsl:param>
<xsl:param name="dest-file">${hdocResultPath}/ressources/<xsl:value-of select="tokenize(@src, '/')[last()]"/></xsl:param>
<mkdir dir="{$dest-rep}"/>
<xsl:param name="dest-file">${hdocResultPath}/ressources/<xsl:value-of select="translate(tokenize(@src, '/')[last()],'?%','_')"/></xsl:param>
<mkdir dir="{$dest-rep}"/>
<get src="{@src}" dest="{$dest-file}" />
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
......@@ -11,11 +11,9 @@
</xsl:template>
<xsl:template match ="/html/body/div/div/div/div[@class='thumb tleft' or @class='thumb tright']" priority="1">
<div class="{@class}">
<xsl:apply-templates select=".//img" />
<xsl:apply-templates select=".//div[@class='thumbcaption']" />
<xsl:apply-templates select=".//div[@class='thumbcaption']" />
</div>
</xsl:template>
......
......@@ -85,7 +85,7 @@
<xsl:apply-templates select="following-sibling::div[contains(@class,'thumb tleft') or contains(@class,'thumb tright')] intersect $nextTitle/preceding-sibling::*"/>
<!-- <xsl:apply-templates select="following-sibling::p/img"/>-->
<!-- If there is text right below the section name, copy it -->
<xsl:if test="not(following-sibling::*[1] intersect following-sibling::h3) and not(following-sibling::*[1] intersect following-sibling::h4) and not(following-sibling::*[1] intersect following-sibling::h5) and not(following-sibling::*[1] intersect following-sibling::h6)">
<div>
......@@ -93,6 +93,7 @@
<xsl:for-each select="following-sibling::* intersect following-sibling::h2[1]/preceding-sibling::*">
<xsl:if test="not(preceding-sibling::h3 intersect $currentSectionTitle/following-sibling::h3) and not($currentSectionTitle/following-sibling::h4 intersect preceding-sibling::h4) and not($currentSectionTitle/following-sibling::h5 intersect preceding-sibling::h5) and not($currentSectionTitle/following-sibling::h6 intersect preceding-sibling::h6) and not(self::h3) and not(self::h4) and not(self::h5) and not(self::h6)">
<xsl:apply-templates select="." mode="textOnly"/>
<!--To add images it took me almost 1h and a half I believe strongly that the structure of this page can be changed and made easy !! -->
</xsl:if>
</xsl:for-each>
</div>
......@@ -148,7 +149,7 @@
</xsl:template>
<!-- Text elements not surrounded by div -->
<xsl:template match="p|span|i|ul|ol" mode="textOnly">
<xsl:template match="p|span|i|ul|ol" mode="textOnly" >
<xsl:element name="{local-name()}" namespace="http://www.utc.fr/ics/hdoc/xhtml">
<xsl:apply-templates select="node()" mode="textOnly"/>
</xsl:element>
......@@ -387,15 +388,16 @@
<!-- Images -->
<xsl:template match="div[contains(@class,'thumb')]">
<div>
<xsl:apply-templates select=".//img"/>
<xsl:apply-templates select=".//img" mode="textOnly"/>
<xsl:apply-templates select=".//p[@class='thumbcaption']"/>
</div>
</xsl:template>
<xsl:template match="img">
<img src="./ressources/{tokenize(@src, '/')[last()]}" alt="{@alt}"/>
<xsl:template match="img" mode="textOnly">
<img src="./ressources/{translate(tokenize(@src, '/')[last()],'?%','_')}" alt="{@alt}"/>
</xsl:template>
<xsl:template match="p[@class='thumbcaption']">
<p> <xsl:value-of select="text()"/> </p>
</xsl:template>
......
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