开发者

xsl: How to select the first x number of characters in a node?

开发者 https://www.devze.com 2023-03-03 03:20 出处:网络
I have the following node in a XML doc: <node>This is some text.</node> I want to selec开发者_Python百科t the first 10 characters of the text. How can I do this?You can use the substrin

I have the following node in a XML doc:

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

I want to selec开发者_Python百科t the first 10 characters of the text. How can I do this?


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

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

Hope this helps


Try this

substring(/node,1,10)

Reference for substring fn.

0

精彩评论

暂无评论...
验证码 换一张
取 消