Found a really useful XML editor that runs on the Mac, XML Spear
The following example transforms the supplied xml string, using XSL/T and outputs to another string
using (StringReader rdr = new StringReader(selectedLine.AdditionalInformation))
{
XPathDocument doc = new XPathDocument(rdr);
using (StringWriter writer = new StringWriter())
{
transformer.Transform(doc, null, writer);
titleLabel.Attributes.Add("onmouseover", string.Format(@"showDiv(""{0}"")", writer.ToString()));
}
}
The XSL/T loaded into the transformer variable is as follows
And a sample xml string is as follows:
The result from the transformation is as follows:
Body Rides
Additional answer code
Additional answer date
Answer code
TOS
Answer date
Author
Richard Laymon
Delivery to
Company Name, Address Line 1, AddressLine 2
Expected delivery
09/08/2009
Held orders
Ordered on
20/07/2009
Print runs
The code to build up the xml within the object is below, note that the values are HtmlEncoded to ensure that there are no problems in the web page.
public string AdditionalInformation
{
get
{
StringBuilder builder = new StringBuilder();
builder.Append(string.Format(CultureInfo.CurrentCulture,
@"