apply templates select substring-after

自古美人都是妖i 提交于 2019-12-13 04:44:02

问题


I've the below XML line.

<toc-title>1.   <content-style>Short title</content-style></toc-title>

here i wanted to apply templates on substring-after 1.

I tried the below XSLT.

<xsl:template match="toc-title/text()" mode="x">
    <xsl:analyze-string select="substring-after(.,' ')" regex="([a-z]+)">
        <xsl:matching-substring>
            <xsl:apply-templates select="regex-group(1)" mode="x"/>
        </xsl:matching-substring>
        <xsl:non-matching-substring>
            <xsl:value-of select="."/>
        </xsl:non-matching-substring>
    </xsl:analyze-string>
</xsl:template>

<xsl:template match="text()" mode="x">

</xsl:template>

but when i run this it throws the below error.

XSLT 2.0 Debugging Error: Error: file:///C:/Users/u0138039/Desktop/FLPHK_CHAP.xsl:239: Not a node item - item has type xs:string with value 'title' -   Details: -     XTTE0520: The result of evaluating the 'select' attribute of the <xsl:apply-templates> instruction may only contain nodes

I'm, unable to how to do this. please help me on fixing it.

Thanks

来源:https://stackoverflow.com/questions/27165917/apply-templates-select-substring-after

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!