在使用典型的 CMD/Bat 文件处理以在 MS Windows 中启动 XSLT3.0 样式表时,我尝试向我的
<xsl:message>
输出添加上下文颜色。
经过多次失败的尝试后,我发现本教程在对终端进行注册表编辑后确实改变了cmd回显的颜色
[36mThis is blue[0m
然后我尝试在简单的
<xsl:message>
中使用上面的代码,并得到以下错误。
SXXP0003: Error reported by XML parser: An invalid XML character (Unicode: 0x1b) was found
in the element content of the document.
org.xml.sax.SAXParseException; systemId: file:/C:/Temp/idr_migration/10year_Archive_Migration/xslt3_xml_to_josn.xsl; lineNumber: 49; columnNumber: 23; An invalid XML character (Unicode: 0x1b) was found in the element content of the document
是否有一些特殊的方法来使用字符映射来转换此字符,以便 XSLT 将运行并序列化输出以提醒 CMD/终端以所需的颜色打印消息?
这是否可以在
<xsl:message>
内发送颜色代码,或者他们是否有其他选项来向控制台指定颜色?
一些 Saxon 用户已经为 VS Code XSLT 扩展实现了这一点(他是该扩展的作者),该项目位于 Github 上 https://github.com/pgfearo/alt-saxon-xslt-cli。