xslt - xsl replacing of an empty element with another -
i have xml stylesheet takes multiple xml documents , converts , combines them. xml documents contain same detail, node names different. in 1 gives me problems, have a:
<description> text... <newline/> text... <newline/> text... </description>
how can change to:
<details> <p>some text...</p> <p>some text...</p> <p>some text...</p> </details>
using xslt obtain result expect, source xml provided:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:template match="description"> <details> <xsl:apply-templates /> </details> </xsl:template> <xsl:template match="description/text()"> <p><xsl:value-of select="normalize-space(.)"/></p> </xsl:template> </xsl:stylesheet>
if source more complex, have adjust stylesheet deal that. i'm assuming <newline/>
tag (and not representation of newline character, , empty).
Comments
Post a Comment