I have an xml doc like this :
<doc>
<article>
<photo>
<caption>
<p>
caption text<credit>photo copyright</credit>
</p>
</caption>
</photo>
</article>
</doc>
As you can see the “credit” tag is nested in the “p” tag…
I have an xsl code like this :
<xsl:template match="/doc">
<caption>
<xsl:for-each select="article/photo">
<xsl:value-of select="caption/p"/>
<xsl:text>
</xsl:text>
<xsl:value-of select="caption/p/credit"/>
</xsl:for-each>
</caption>
</xsl:template>
So I have an output like this :
<caption>
caption text photo copyright
photo copyright
</caption>
What I would need is just removing the nested “credit” tag, and its content, but only for my first value-of element, as I need to keep it for my second value-of. So I would get this output :
<caption>
caption text
photo copyright
</caption>
Which would be better as I don’t want the photo copyright to be repeated… but I do need a line break between caption text and photo copyright…