summaryrefslogtreecommitdiff
path: root/help3xsl/online_transform.xsl
diff options
context:
space:
mode:
authorOlivier Hallot <olivier.hallot@libreoffice.org>2017-12-21 19:22:29 -0200
committerJan Holesovsky <kendy@collabora.com>2018-08-06 18:23:12 +0200
commit9da5124502238b081f156cf4f4c0ea5ab821b572 (patch)
tree737b4e028c00fd2c008221fe6a4625d5a4462a89 /help3xsl/online_transform.xsl
parent7cad887a2b76895a7a2770e9666ef96735e723cc (diff)
Relativise <base href="/"> wrt file position
Now <base href="/"> is changed to <base href="../../../ (...) ../" to allow links to operate with http:// and file:// protocol Drop param from makefile too Change-Id: I1aea5b9c564bdfe395e95400ecf87e068a5a7c86 Reviewed-on: https://gerrit.libreoffice.org/46932 Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org> Tested-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl/online_transform.xsl')
-rw-r--r--help3xsl/online_transform.xsl108
1 files changed, 63 insertions, 45 deletions
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index 6349bfa77d..95a1269c0b 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -30,7 +30,6 @@
<xsl:param name="productversion"/>
<xsl:param name="local" />
-<xsl:param name="fileTree"/>
<xsl:param name="root"/>
<xsl:param name="Language"/>
@@ -59,7 +58,6 @@
<!-- Installation -->
<xsl:variable name="online" select="$local!='yes'"/>
-<xsl:variable name="install" select="$fileTree"/>
<!-- meta data variables from the help file -->
<xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/>
@@ -113,6 +111,11 @@
<xsl:variable name="titleL10N">
<xsl:call-template name="brand"><xsl:with-param name="string"><xsl:value-of select="$title"/></xsl:with-param></xsl:call-template>
</xsl:variable>
+ <xsl:variable name="install">
+ <xsl:call-template name="tokenize">
+ <xsl:with-param name="str" select="$filename"/>
+ </xsl:call-template>
+ </xsl:variable>
<html lang="{$lang}">
<head>
<base href="{$install}"/>
@@ -290,15 +293,14 @@
<xsl:when test="$online">
<script type="text/javascript">
<![CDATA[
- var userLang = navigator.language || navigator.userLanguage;
+ var userLang = navigator.language || navigator.userLanguage;
var module = getParameterByName("DbPAR");
setModule(module);
var system = getParameterByName("System");
setSystem(system);
fixURL(module,system);
var dbg = getParameterByName("Debug");
- if (dbg == null){dbg=1}
- //dbg=1
+ if (dbg == null){dbg=0}
document.getElementById("DEBUG").style.display = (dbg == 0) ? "none":"block";
document.getElementById("bm_module").innerHTML ="Module is: "+module;
document.getElementById("bm_system").innerHTML ="System is: "+system;
@@ -1080,56 +1082,56 @@
<!-- Insert a Table -->
<xsl:template name="inserttable">
- <xsl:variable name="imgsrc"> <!-- see if we are in an image table -->
- <xsl:value-of select="tablerow/tablecell[1]/paragraph[1]/image/@src"/>
- </xsl:variable>
+ <xsl:variable name="imgsrc"> <!-- see if we are in an image table -->
+ <xsl:value-of select="tablerow/tablecell[1]/paragraph[1]/image/@src"/>
+ </xsl:variable>
- <xsl:choose>
- <xsl:when test="count(descendant::tablecell)=1">
- <table border="0" class="onecell" cellpadding="0" cellspacing="0">
- <xsl:apply-templates />
- </table>
- </xsl:when>
+ <xsl:choose>
+ <xsl:when test="count(descendant::tablecell)=1">
+ <table border="0" class="onecell" cellpadding="0" cellspacing="0">
+ <xsl:apply-templates />
+ </table>
+ </xsl:when>
- <xsl:when test="descendant::tablecell[1]/descendant::image">
- <table border="0" class="icontable" cellpadding="5" cellspacing="0">
- <xsl:apply-templates mode="icontable"/>
- </table>
- </xsl:when>
+ <xsl:when test="descendant::tablecell[1]/descendant::image">
+ <table border="0" class="icontable" cellpadding="5" cellspacing="0">
+ <xsl:apply-templates mode="icontable"/>
+ </table>
+ </xsl:when>
- <xsl:when test="@class='wide'">
- <table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" >
- <xsl:apply-templates />
- </table>
- </xsl:when>
+ <xsl:when test="@class='wide'">
+ <table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" >
+ <xsl:apply-templates />
+ </table>
+ </xsl:when>
- <xsl:when test="not(@class='')">
- <table border="1" class="{@class}" cellpadding="0" cellspacing="0" >
- <xsl:apply-templates />
- </table>
- </xsl:when>
+ <xsl:when test="not(@class='')">
+ <table border="1" class="{@class}" cellpadding="0" cellspacing="0" >
+ <xsl:apply-templates />
+ </table>
+ </xsl:when>
- <xsl:otherwise>
- <table border="1" class="border" cellpadding="0" cellspacing="0" >
- <xsl:apply-templates />
- </table>
- </xsl:otherwise>
- </xsl:choose>
- <br/>
+ <xsl:otherwise>
+ <table border="1" class="border" cellpadding="0" cellspacing="0" >
+ <xsl:apply-templates />
+ </table>
+ </xsl:otherwise>
+ </xsl:choose>
+ <br/>
</xsl:template>
<xsl:template name="resolveembed">
- <div class="embedded">
- <xsl:variable name="href"><xsl:value-of select="concat($urlpre,substring-before(@href,'#'))"/></xsl:variable>
- <xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
- <xsl:variable name="docum" select="document($href)"/>
+ <div class="embedded">
+ <xsl:variable name="href"><xsl:value-of select="concat($urlpre,substring-before(@href,'#'))"/></xsl:variable>
+ <xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
+ <xsl:variable name="docum" select="document($href)"/>
- <xsl:call-template name="insertembed">
- <xsl:with-param name="doc" select="$docum" />
- <xsl:with-param name="anchor" select="$anc" />
- </xsl:call-template>
+ <xsl:call-template name="insertembed">
+ <xsl:with-param name="doc" select="$docum" />
+ <xsl:with-param name="anchor" select="$anc" />
+ </xsl:call-template>
- </div>
+ </div>
</xsl:template>
<xsl:template name="resolveembedvar">
@@ -1168,4 +1170,20 @@
<xsl:value-of select="concat(substring-before($file,'.xhp'),'.html')"/>
</xsl:template>
+<!-- recursive named template -->
+<xsl:template name="tokenize">
+ <xsl:param name="str" />
+ <xsl:param name="result" select="''" />
+ <xsl:choose>
+ <xsl:when test="substring-after($str,'/')">
+ <xsl:call-template name="tokenize">
+ <xsl:with-param name="str" select="substring-after($str,'/')" />
+ <xsl:with-param name="result" select="concat($result,'../')" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('../',$result)" />
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
</xsl:stylesheet>