Archive for 'XML' Category

XSLT 1.0, Join a list of elements’s value with separator

By admin - Last updated: Thursday, February 26, 2009

In order to join a sequence with a customized separator in XSLT 1.0, similar to C# function string.Join( array, separator), I’ve come up with a template which takes the sequence and separator as parameter. Given a sample XML <?xml version=”1.0″ encoding=”utf-8″ ?> <?xml-stylesheet type=”text/xsl” href=”ElementJoin.xslt”?> <Root>   <Years>     <int>2008</int>     <int>2009</int>   […]

XSLT XML transformation vs Object mapping

By admin - Last updated: Monday, February 9, 2009

I’ve run some tests on transformation from one XML schema to the other so that I can compare the performance between XSLT and XmlSerializer with object mapping as well as the Pros and Cons. It appears XSLT transformed my source XML to target XML faster than the object mapping since XSLT doesn’t take the type […]

C# XmlSerializer, Add an attribute to an array element

By admin - Last updated: Friday, June 27, 2008

In order words, add an attribute to an object element after xml serialization, If you want something like, <Rats count=“2”>   <Rat>little rat</Rat>   <Rat>old rat</Rat> </Rats> The C# code is [XmlType(“Rats”)]     public class Rats     {         [XmlAttribute(“count”)]         public int Count { get; set; […]