2016-12-22 44 views
0

由於更改目錄,我需要在我的文檔()路徑文件使用XSL:變量作爲文件路徑的一部分

<xsl:variable name="topicdir" select="(tokenize(base-uri(), '/')[last()-1])"/> 
<xsl:variable name="mapTitle" select="(document('../bin/out/index.ditamap'))//title"/> 

而不是「出來」使用一個變量,我需要$ topicdir那裏。我如何連接這個?我似乎無法得到它的工作...

在此先感謝! 桑德

+0

的可能的複製[你能有XSL變量的文件()函數?] (http://stackoverflow.com/questions/4784495/can-you-have-xsl-variables-in-the-document-function) – Utkanos

回答

1

嘗試......

<xsl:variable name="mapTitle" select="(document(concat('../bin/', $topicdir, '/index.ditamap')))//title"/> 

或者,也許是爲了避免過多的嵌套函數

<xsl:variable name="docName" select="concat('../bin/', $topicdir, '/index.ditamap')" /> 
<xsl:variable name="mapTitle" select="(document($docName))//title"/> 
+0

謝謝!你的版本似乎工作得很好,在嘗試_concat_時,我想我搞砸了一些單引號和雙引號。我會在你的第二個建議! –

相關問題