XSL Transformation

1 view
Skip to first unread message

karthick

unread,
Oct 3, 2005, 4:24:12 AM10/3/05
to .NetIndia
1. karthick Oct 3, 9:23 am show options

Newsgroups: microsoft.public.dotnet.languages.csharp
From: "karthick" <tvkarth...@gmail.com> - Find messages by this author

Date: 3 Oct 2005 01:23:02 -0700
Local: Mon, Oct 3 2005 9:23 am
Subject: XSL Transformation
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

Hi,


I have a XML file generated from a DataSet. I need to some how
transform the custom columns in XML to a normal column, just like this
:


<customColumn> example col here </customColumn>


TO


<td> example col here </td>


What's the best way to do it and How do I do it ?. I am also looking
for suggestions as to whether to write the formatted XML file straight
away after getting the info from the DataSet or after writing the XML
file first ?. Please help.

BabuLives

unread,
Oct 3, 2005, 4:48:19 AM10/3/05
to .NetIndia
I think u can go for XslTranform Class for transforming to html(td)
with the help of style sheets written...


Regards,
Satheesh

sankar

unread,
Oct 3, 2005, 12:13:36 PM10/3/05
to Techdot...@googlegroups.com

Hi Karthick

this is a function i  written for writting a xml file like this

<

Menu Name="sss-k2">

<Item Text="Add k2"  PostBack="True" />

<Item Text="Add k3" PostBack="True" />

</Menu>

<Menu Name="sss-k3">

<Item Text="Add k3" PostBack="True" />

</Menu>

 

public void WriteXml(ArrayList getLevels )

{

XmlDocument xmlDocContext = new XmlDocument();

xmlDocContext.Load(Server.MapPath(@"XMLContentFile.xml"));

for(int i =0;i<getLevels.Count;i++)

{

XmlElement xmlNewMenu = xmlDocContext.CreateElement("Menu");

xmlNewMenu.SetAttribute("Name",getLevels[i].ToString());

xmlDocContext.DocumentElement.AppendChild(xmlNewMenu);

// XmlElement firstelement = xmldoc.CreateElement("Book");

for(int j = 1;j < 6; j++)

{

XmlElement xmlNewItem = xmlDocContext.CreateElement("Item");

string[] ss = getLevels[i].ToString().Split('-');

xmlNewItem.SetAttribute("Text", "Add "+ j +" "+ ss[1].ToString());

xmlNewItem.SetAttribute("PostBack", "True");

xmlNewMenu.AppendChild(xmlNewItem);

}

try

{

for(int k = 1;k < 6; k++)

{

XmlElement xmlNewItem1 = xmlDocContext.CreateElement("Item");

string[] ss1 = getLevels[i+1].ToString().Split('-');

xmlNewItem1.SetAttribute("Text", "Add "+ k +" "+ ss1[1].ToString());

xmlNewItem1.SetAttribute("PostBack", "True");

xmlNewMenu.AppendChild(xmlNewItem1);

}

}

catch

{}

}

// Save the XML file

xmlDocContext.Save(Server.MapPath(@"XMLContentFile.xml"));

 

 

}

 

dont worry abt loop .its my requirement.just check the items,Menu i have added.i hope u have some idea on seeing this function.

 

Regards

Sankar

 

 



karthick <tvkar...@gmail.com> wrote:

1. karthick Oct 3, 9:23 am show options

Newsgroups: microsoft.public.dotnet.languages.csharp
From: "karthick" - Find messages by this author


Date: 3 Oct 2005 01:23:02 -0700
Local: Mon, Oct 3 2005 9:23 am
Subject: XSL Transformation
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

Hi,


I have a XML file generated from a DataSet. I need to some how
transform the custom columns in XML to a normal column, just like this
:


example col here


TO


example col here



What's the best way to do it and How do I do it ?. I am also looking
for suggestions as to whether to write the formatted XML file straight
away after getting the info from the DataSet or after writing the XML
file first ?. Please help.


Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.

Reply all
Reply to author
Forward
0 new messages