xsl: How to select the first x number of character

2019-06-15 11:20发布

问题:

I have the following node in a XML doc:

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

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

回答1:

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

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

Hope this helps



回答2:

Try this

substring(/node,1,10)

Reference for substring fn.



标签: xml xslt