xml - XSL - 从网络上的目录生成文件列表
问题描述
我正在尝试使用collection
函数列出具有 xsl 的目录文件。它似乎适用于正常用例(在本地目录中搜索),但在网络上搜索路径时失败:例如。\\name_of_machine\the\path\to\folder
日志错误是:
FODC0002: The file or directory
file:/D:/the/current/location/of/the/executing/xsl/%5C%5Cname_of_machine2%5Cthe%5Cpath%5Cto%5Cfolder does not exist
还有我的代码片段:
<xsl:variable name="docList" select="for $f in collection($dir) return lower-case($f)"/>
因此,基本上,该collection
函数将执行代码的 XSL 文件的当前位置放在前面,然后转义所有 \(反斜杠)字符。
如何使用收集功能通过网络检索文件?
编辑:我正在使用 Saxon-HE 9.8.0-15
解决方案
我认为您可以使用例如<xsl:variable name="doc-list" select="uri-collection('file:////name_of_machine/the/path/to/folder?select=*.xml')"/>
获取 Saxon 9 目录中文件的 URI 列表。我认为表示此类路径的 URI 语法是file:////name_of_machine/the/path/to/folder
.
在使用 Saxon 9.8 的 Windows 10 机器上进行的测试给出了
java -cp 'C:\Program Files\Saxonica\Saxon9.8HE\saxon9he.jar' net.sf.saxon.Query -t -qs:"uri-collection('file:////machine-name/Users/marti/SomeFolder/xml?select=*.xml')"
Saxon-HE 9.8.0.15J from Saxonica
Java version 1.8.0_252
Analyzing query from {uri-collection('file:////machine-name/Users/marti/SomeFolder/xml?select=*.xml')}
Analysis time: 194.6869 milliseconds
<?xml version="1.0" encoding="UTF-8"?>file:////machine-name/Users/marti/SomeFolder/xml/sample1.xml file:////machine-name/Us
ers/marti/SomeFolder/xml/sample2.xml
推荐阅读
- python - 与服务器上运行的 python 脚本保持通信
- excel - 带有 word 文档附件的 VBA 宏电子邮件
- python - Documentum REST API (dm_audittrail)
- python - 带有 aiocache 和 Redis 的 FastAPI 无法设置 databases.backends.postgres.Record 对象
- c# - 如何在 C# Telegram Bot API 中请求联系
- flutter - Flutter - 将计算作为文本传递到不同的屏幕
- javascript - 2 菜单 javascripts 与 echother 冲突
- node.js - 无法使用 ngrok 访问其他路线
- javascript - Ajax 轮询 - 无延迟触发超时
- node.js - 尽可能快地汇总一个大数组(200,000+)的对象