使用 xsl 获取 xml 文件的文件名 [英] get file name of xml file with xsl

查看:38
本文介绍了使用 xsl 获取 xml 文件的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 xsl 2.0 获取当前访问的 xml 文档名称的最佳方法是什么?

What's the best way to get the name of a currently accessed xml document with xsl 2.0?

我猜是 resolve-uri 和 base-uri 的某种组合.

I guess it's some combination of resolve-uri and base-uri.

Base-uri 给了我绝对路径,但我只需要文件名,不需要路径.有没有一种聪明的方法来做到这一点,而无需太多 substring-before 之类的东西?

Base-uri gives me the absolute path, but I only need the name of the file, without the path. Is there a smart way to do this wiithout much substring-before and stuff like that?

所以当路径是C:/Users/abc/Desktop/somefile.xml时,我需要somefile.xml.

So when the path is C:/Users/abc/Desktop/somefile.xml, I need somefile.xml.

感谢您的帮助和提示!

推荐答案

怎么样:

tokenize(base-uri(), '/')[last()]

这篇关于使用 xsl 获取 xml 文件的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆