XSL Rookie - 我可以制作一个与“这个短语”匹配的 XSL 吗? 也匹配“ths fraze” 无需重复整个“if测试” 堵塞?
我是一个完全的 XSL 新手,正在编写一个 XSL 文件来将应用程序创建的输出日志中出现的许多不同错误消息格式化为 CSV 格式。
这些输出日志中的可匹配标签可能会出现轻微变化。 例如,日志中的一个句子可能包含短语“服务月/年:”,但来自应用程序不同区域的另一个句子可能包含“服务月/年:”。
有没有办法将该短语的这两个变体放在我的 XSL 的一行中? 或者我是否必须重复整个 If 块,并将我想要在其自己的 If 块中匹配的短语中的每个变体重复?
我尝试在此处发布 XSL,并用反引号包围,但它全部集中在一起,无法阅读。 如果有人可以帮助解决这个问题,如果您告诉我如何使其可读,我很乐意将其发布。 :-)
谢谢。
I'm a complete XSL novice, writing an XSL file to format lots of different error messages that can appear in the output log created by an application into CSV format.
Slight variations might occur in the matchable tags in these output logs. For example, one sentence in the log might contain the phrase "Service Month/Year:" but another one, from a different area of the application, would contain "Svc Month/Yr:" instead.
Is there a way to put both those variations of that phrase in a single line of my XSL? Or do I have to repeat the entire If block, with each variation in the phrase that I want to match on in its own If block?
I tried posting the XSL here surrounded by backticks, but it runs all together in one big lump that's impossible to read. If anyone can help with this question, I'm happy to post it if you tell me how to make it readable. :-)
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
XSL 允许像其他语言一样组合条件语句。 每个都不需要其 on if 语句。 你有没有沿着这些思路思考一些事情?
请记住 xml/xsl 区分大小写。 为了使其更加灵活,它更加详细:
编辑:我提出了一个更好的答案
用法:
分隔符可以是您想要的任何字符。 令牌是要搜索的内容的列表,每个内容之间有分隔符。 享受!
XSL allows combining of conditional statements like other langues. Each one doesn't require its on if statement. Were you thinking something along these lines?
Keep in mind xml/xsl is case sensitive. To make it more flexible, it is even more verbose:
EDIT: And an even better answer I whipped up
Usage:
Delimiter can be whatever character or charcters you want. Tokens is a list of things to search for with the delimiter between each one. Enjoy!