Commit e75f910e authored by Hachem Rihab's avatar Hachem Rihab

[hdoc_to_optim] outsource optim chapters

parent 2c0b581d
......@@ -26,7 +26,7 @@
<!--launches the ANT get_content resulting from the previous XSLT in order to launch the conversion-->
<ant antfile="get_content.ant"/>
<!--once the conversion is complete, the result is zipped-->
<zip basedir="result" destfile="${OutputScarPath}"/>
<zip basedir="result" destfile="${OutputScarPath}" encoding="UTF-8"/>
<!--temporary files and folders are deleted-->
<delete dir="hdoc"/>
......
......@@ -13,7 +13,7 @@
</of:paper>
</sc:item>
</xsl:template>
<xsl:strip-space elements="*"/>
<!--Metadata of the head tag-->
<xsl:template match="h:head">
<of:paperM>
......@@ -88,8 +88,23 @@
<!--hdoc sections can become chapters or sections in Optim, we must differentiate the two-->
<xsl:template match="h:body/h:section">
<sp:chap>
<xsl:call-template name="sec-body"/>
<xsl:variable name="chapi" select="(.//text())[1]"/>
<xsl:message><xsl:value-of select="$chapi"/></xsl:message>
<xsl:variable name="chap">
<xsl:choose>
<xsl:when test="contains($chapi,':')">
<xsl:message>Yescontiiii!</xsl:message>
<xsl:value-of select="normalize-space(replace($chapi,':','-'))"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select="normalize-space($chapi)"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:message><xsl:value-of select="$chap"/></xsl:message>
<xsl:message>test</xsl:message>
<sp:chap sc:refUri="{$chap}.section">
<xsl:call-template name="sec-body1">
<xsl:with-param name="chap" select = "$chap" />
</xsl:call-template>
</sp:chap>
</xsl:template>
......@@ -98,6 +113,33 @@
<xsl:call-template name="sec-body"/>
</sp:sec>
</xsl:template>
<xsl:template name="sec-body1">
<xsl:param name = "chap" />
<xsl:message><xsl:value-of select="$chap"/></xsl:message>
<xsl:result-document encoding="UTF-8" href="{$chap}.section" >
<sc:item xmlns:sc="http://www.utc.fr/ics/scenari/v3/core">
<of:section>
<xsl:if test="@data-hdoc-type='introduction'">
<xsl:comment>Introduction</xsl:comment>
</xsl:if>
<xsl:if test="@data-hdoc-type='conclusion'">
<xsl:comment>Conclusion</xsl:comment>
</xsl:if>
<xsl:apply-templates select="h:header"/>
<xsl:if test="./h:div">
<sp:content>
<of:fragment>
<xsl:apply-templates select="h:div"/>
</of:fragment>
</sp:content>
</xsl:if>
<xsl:apply-templates select="h:section"/>
</of:section>
</sc:item>
</xsl:result-document>
<xsl:apply-templates select="h:footer"/>
</xsl:template>
<xsl:template name="sec-body">
<of:section>
......
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