# XSL: copy subnodes and process some of them

This topic is 4230 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I am currently trying to get the following result (HTML):
Microsoft has issued five new bulletins providing patches to solve
several problems.  Due to the criticlality of some of the problems the
application of the patches is highly recommended. Microsoft
from this piece of XML code:
<body tg-ref="en-admin"  headline="Summary">
Microsoft has issued five new bulletins providing patches to solve
several problems.  Due to the criticlality of some of the problems the
</body>
The problem is to copy the text from the body-node and process the child nodes as well. And in the end, everything must fit together. My current approach is to iterate along the descendant-or-self axis and process depending on the node type:
<xsl:for-each select="descendant-or-self::*">
<xsl:if test="name() = 'body'">
<xsl:value-of select="name()"/><xsl:copy-of select="."/>
</xsl:if>
</xsl:if>
</xsl:for-each>

The result is not exactly what I need, but I think it is logical that I don't get what I need. The stylesheet copies the text of the body-node and concatenates the following nodes at the end of this text. Is there a way to get the required results? Maybe a two-pass algorithm where I first copy the body-node's contents and then process all the links in the second pass? Thanks, Enrico

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634136
• Total Posts
3015756
×