带有 XSLT 的文件路径包括 [英] File paths with XSLT includes
问题描述
我正在处理一个包含大量页面的网站,每个页面都包含以下内容:<xsl:include href="team-menu.xsl"/>
I'm working on a website with a large number of pages, and each one has this in it:
<xsl:include href="team-menu.xsl" />
此 xsl 文件存储在根目录中.
This xsl file is stored in the root directory.
基本上在每一页上都包含我的团队菜单".我的问题是当我将它包含在嵌套页面中时,例如/teammembers/smith.xsl",菜单中的链接已损坏,因为它们指向的页面与我正在查看的页面不在同一目录中.
Essentially including my "team menu" on each page. My problem is when I include this on nested pages, e.g. "/teammembers/smith.xsl", the links in the menu are broken because they refer to pages that aren't in the same directory as the page i'm viewing.
这可能真的很简单,但我只是不知道如何解决它.有没有办法告诉 XSL 根目录和/或设置某种全局目录?感谢您的帮助!
This is probably really easy, but I just don't know how to fix it. Is there a way to tell the XSL the root directory and/or set some sort of global directory? Thanks for your help!
推荐答案
如果我正确理解您的问题,您可以使用绝对链接,而不是相对链接.
If I understand your question correctly you could just use absolute links, instead of relative ones.
即/index.xml
而不是 index.xml
.
这篇关于带有 XSLT 的文件路径包括的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!