xml - Read XML-Stylesheet attribute in a XSLT file
问题描述
I need to know if a XML file does have the href attribute from < ?xml-stylesheet type="text/xsl" href="recibo.xsl"? > to determine what kind of Invoice it is (in my XSLT file). I´ve spend quite the time searching but couldn´t find any information on it. Is it even possible to read/acces those attributes in a XSLT?
解决方案
Reading the processing instruction is easy enough: string(/processing-instruction('xml-stylesheet'))
. But that won't parse out the "pseudo-attributes" (type
and href
) in its value. You have to do that yourself, unless your processor provides a vendor extension such as saxon:get-pseudo-attribute
.
推荐阅读
- reactjs - 惰性反应和 HOC 类型,类型“未知”不可分配给类型“组件类型”
- react-native - 如何在本机反应中实现以下设计?
- ios - 将可选的 @objc 枚举类型传递给 @objc 协议
- firebase - 如何向 Map 类型的地图添加值
? - ios - 如何修复模拟器 Swift xcode 上的视图高度?
- api - 如何在 Swagger 2.0 中处理多个 400 响应
- java - 用户通过 orElseThrow 方法定义的异常
- excel - 从其他列的一列中查找并突出显示选定的连续单元格
- robotframework - PyCharm安装成功后Faker库不提供关键字
- antlr - ANTLR:如何摆脱 'missing NEWLINE at '
''?