Menu

#171 Method "relpath:getParent" does not properly work on Windows

Current_release
open
nobody
None
1
2014-07-14
2014-07-14
Radu Coravu
No

The XSL:

DITA-OT/plugins/net.sourceforge.dita4publishers.common.xslt/xsl/lib/relpath_util.xsl

has a method:

          <xsl:function name="relpath:getParent" as="xs:string">
            <xsl:param name="sourcePath" as="xs:string"/>
            <xsl:value-of select="string-join(tokenize($sourcePath, '/')[position() &lt; last()], '/')"/>
          </xsl:function>

which does not work properly on Windows because the directories are separated by "\" so in order for it to properly work on Windows you could do something like:

<xsl:function name="relpath:getParent" as="xs:string">
  <xsl:param name="sourcePath" as="xs:string"/>
  <xsl:variable name="correctedSourcePath" select="replace($sourcePath, '\\', '/')"/>
  <xsl:value-of select="string-join(tokenize($correctedSourcePath, '/')[position() &lt; last()], '/')"/>
</xsl:function>

As a side effect of the problem on Windows the HTML2 output does not show images.

Discussion

Anonymous
Anonymous

Add attachments
Cancel