I have a System.xml.xmlDocument()
object which is rendered onto a web page by using XSL. I want to insert a 'linebreak` inside certain nodes in the XML object, so when the XML is rendered using XSLT there is an actual line break there. My Code to do this looks like this:
Dim parentNodes As System.Xml.XmlNodeList = objOutput.SelectNodes("//PARENT")
Dim currentParentValue As String = String.Empty
Dim resultParent As String = String.Empty
For Each par As System.Xml.XmlNode In parentNodes
currentParentValue = par.InnerText
Dim parArray As String() = currentParentValue.Split(";")
If parArray.Length > 2 Then
resultParent = String.Empty
Dim parCounter As Integer = 0
For Each Parent As String In parArray
parCounter = parCounter + 1
resultParent = resultParent + Parent + "; "
If (parCounter Mod 2) = 0 Then
resultParent = resultParent + "
"
End If
Next
End If
par.InnerText = resultParent
Next
And in XSL:
<td width="50%" nowrap="nowrap">
<xsl:value-of select="STUDENT_DETAILS/PARENT"/>
</td>
However, it looks like xmlDocument
is automatically escaping the next line character, so it just appears as text on the page, can anyone tell how to fix this?
` tag, not a line feed character. – michael.hor257k Dec 03 '13 at 17:35
` tags between the items in the list. If you want to do the pre-processing, why not actually break the element up into a list of sub-elements, and then let the XSLT output them however it likes. – Steven Doggart Dec 03 '13 at 17:49