简体   繁体   English

格式化XSL转换中的URI

[英]Formatting a URI in a XSL transformation

I am using nginx and I am trying to do an directory listing using the xslt transformation 我正在使用nginx,我正在尝试使用xslt转换进行目录列表

the xslt I got from here https://gist.github.com/wilhelmy/5a59b8eea26974a468c9 我从这里得到的xslt https://gist.github.com/wilhelmy/5a59b8eea26974a468c9

This is the line that prints out the file 这是打印出文件的行

But the problem is current() doesn't do any URI encoding and filenames with % cause problems. 但问题是current()没有做任何URI编码和带有%cause问题的文件名。

From my limited knowledge I am using xslt v1 so I am missing out on some of the XQuery ? 从我有限的知识我使用xslt v1所以我错过了一些XQuery? function line encode uri. 功能线编码uri。

But I found http://www.getsymphony.com/download/xslt-utilities/view/55460/ 但我找到了http://www.getsymphony.com/download/xslt-utilities/view/55460/

which has a library ? 哪个有图书馆? template for encoding uri's 用于编码uri的模板

but I am unsure how to change 但我不确定如何改变

to include 包括

if I try adding the above in the href=" i get errors. 如果我尝试在href =“我得到错误中添加以上内容。

Thanks 谢谢

Found my answer 找到我的答案

              <xsl:element name="a">
                 <xsl:attribute name="href">
                   <xsl:call-template name="url-encode">
                     <xsl:with-param name="str" select="current()" />
                   </xsl:call-template>
                 </xsl:attribute>
                 <xsl:value-of select="." />
               </xsl:element>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM