xsl:如何选择节点中的前 x 个字符? [英] xsl: How to select the first x number of characters in a node?

查看:19
本文介绍了xsl:如何选择节点中的前 x 个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 XML 文档中有以下节点:

I have the following node in a XML doc:

<node>This is some text.</node>

我想选择文本的前 10 个字符.我该怎么做?

I want to select the first 10 characters of the text. How can I do this?

推荐答案

您可以使用 substring 函数选择前 10 个字符.

You can use the substring function to select the first 10 characters.

<xsl:value-of select="substring(node/text(),1,10)"/>

希望能帮到你

这篇关于xsl:如何选择节点中的前 x 个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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