首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >xsl -从第二行(从符号20到符号30 )取字符串。

xsl -从第二行(从符号20到符号30 )取字符串。
EN

Stack Overflow用户
提问于 2016-09-26 15:01:48
回答 1查看 37关注 0票数 0
代码语言:javascript
运行
复制
<msg>
I told my son, “You will marry the girl I choose.” He said, “NO!” 
I told him, “She is Bill Gates’ daughter.” He said, “OK.” 
I called Bill Gates and said, “I want your daughter to marry my son.” 
Bill Gates said, “NO.” I told Bill Gates, My son is the CEO of World Bank.” Bill Gates said, “OK.” I called the President of World Bank and asked him to make my son the CEO. He said, “NO.” I told him, “My son is Bill Gates’ son-in-law.” He said, “OK.” This is exactly how politics works . . .
</msg>

我想从第一排从10到20,从第二排从9到19,从第5到第15,从第3排从18到21,我想从第一排到第二排,从第二排到第二排,从第五到第十五,从第三排,从第一排到第一排,从第一排到第一排,从第一排到第十九排,从第二排到第二排,从第五到第十五,从第三排,从第一排到第一排,从第一排到第十九排,从第二排到第二排,从第五到第十五,从第三排到第二排,从18到21,

所以我得到了一些东西

代码语言:javascript
运行
复制
<line1> son, “You </line1>
<line2> im, “She </line2>
<line3> lled Bill Gates d sa</line3>

因此,从10到20之间选择一行字符串,包括类似xsl:)中的空字符串,这是可能的吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-26 15:30:05

XSLT2.0中,您可以这样做:

代码语言:javascript
运行
复制
<xsl:template match="msg">
    <xsl:variable name="lines" select="tokenize(., '&#10;')" />
    <line1>
        <xsl:value-of select="substring($lines[1], 10, 10)" />
    </line1>
    <line2>
        <xsl:value-of select="substring($lines[2], 9, 10)" />
    </line2>
    <line3>
        <xsl:value-of select="substring($lines[3], 5, 10)" />
    </line3>
</xsl:template>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39706184

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档