开发者

XSLT select text and tags after some elements

开发者 https://www.devze.com 2023-03-05 15:29 出处:网络
this might sound easy problem to you, but somehow Im stuck with it, here is the scenario, I have an xml doc that looks smth like:

this might sound easy problem to you, but somehow Im stuck with it, here is the scenario, I have an xml doc that looks smth like:

<doc>
<id>25147</id>
<article>Peggy Lee</article>
<url>http://en.wikipedia.org/wiki/Peggy_Lee</url>
Peggy Lee (May 26, 1920 – January 21, 2002) was an <a href="United_States">American</a> <a href="Jazz">jazz</a> and ...
</doc>

Now, I'm interested to select the text such as Peggy Lee...., plust the a href tags and all other tags, but not , nor article and other previous tags, as I've selected those before. Any solution?

So the output should be:

 Peggy Lee (May 26, 1920 – January 21, 2002) was an <a href="United_States">American</a> <a href="Jazz">jazz</a> and ...

开发者_JS百科thanx in advance


Try something like this:

<xsl:template match="doc">
 <xsl:copy-of select="url/following::node()"/>
</xsl:template>
0

精彩评论

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

关注公众号