如何在 xslt 中提取此格式 [英] How to extract this format in xslt

查看:23
本文介绍了如何在 xslt 中提取此格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 xml 结构:

I have an xml structure:

<Date>Mon, 11 Aug 2009 13:15:10 GMT</Date> 

我只想提取 15:10 或15"和10".使用 xslt 的最佳方法是什么

i want to extract only 15:10 or '15' and '10'. What is the best way to do that using xslt

推荐答案

如果日期只在时间字段中包含冒号并且时间总是以 HH:MM:SS 格式表示,然后选择第一个冒号后的固定长度子字符串应该可以解决您的问题

If the date contains a colon only in the time field and time is always represented in the format HH:MM:SS then selecting a fixed length substring after first colon should solve your problem

未经测试的 XSLT 单行

untested XSLT one-liner

<xsl:variable name="time" select="substring(substring-after(Date, ':'), 1, 5)"/>

这篇关于如何在 xslt 中提取此格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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