revenpiter
New Member
I have an xml document with the below structure. I'm writing a transformation where I'd like to output the text from node B but ignore the element C and text node "title". Essentially I'd like to extract the text "text goes here" and output it in a new element with all the whitespace normalised. Can anybody help? The below is what I've tried so far.\[code\]Input Doc<A> <B> <C>title</C> text goes here </B></A>Required output doc<d>text goes here</d>Solution A:<xsl:template match="B"> <d> <xsl:copy-of select="./text()"/> </d></xsl:template>\[/code\]Problem: the whitespace between elements is preserved so I get something like this:\[code\]<d> Text goes here</d>\[/code\]I also tried using a value-of statement (\[code\]<xsl:value-of select="./text()"/>\[/code\]) in the template in solution A but this didn't return any text at all. Is there something wrong with the statement?I should mention that I have overridden the the default text handling template using the following: \[code\]<xsl:template match="text()" />\[/code\]Thanks