How do I get the current folder path within an XSLT file?

前端 未结 7 1768
萌比男神i
萌比男神i 2020-12-15 20:23

Is there a way to get the current folder path from within a XSLT file?

I need it to locate other XML and XSLT files. We have different customer folders and will need

相关标签:
7条回答
  • 2020-12-15 21:12

    In MSXSL on Windows, you can use a script extension like this:

    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxsl="urn:schemas-microsoft-com:xslt"
      xmlns:user="http://tempuri.org/msxsl"
    >
    
      <msxsl:script language="JScript" implements-prefix="user">
    <![CDATA[
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    
    function getCurrentPath(){
      return fso.GetFolder(".").Path
    }
    ]]>
      </msxsl:script>
    
      <xsl:template match="/">
        <xsl:value-of select="user:getCurrentPath()"/>
      </xsl:template>
    
    </xsl:stylesheet>
    

    Other XSL processors support similar methods to use external resources (scripting languages, function libraries etc.), so this is just an example.

    0 讨论(0)
提交回复
热议问题