473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

formatting xml document dynamically

Hello All,
I have an asp.net search application that brings up a datagrid of results,
with one of the fields being a hyperlink to an XML document, of which there
are thousands. By clicking this link, the browser loads the XML document in
its raw form.
My question is, how do I use some of these formatting techniques (XSL etc)
to format this XML the way I want to, after the link is clicked on?

A nudge in the right direction would be appreciated, as I can't seem to
find any example of what I am doing.

Thanks
Miki
Nov 12 '05 #1
2 2509
HI Miki,

You should be able to use the XslTransform class.
Below is an example

XslTransform xslt = new XslTransform();

//Load the stylesheet.
xslt.Load("http://server/YourXSLFileHere.xsl");

//Create a new XPathDocument and load the XML data to be transformed.
XPathDocument mydata = new XPathDocument("inputdata.xml");

//Create an XmlTextWriter which outputs to the console.
XmlWriter writer = new XmlTextWriter(<Output file or Response Stream Here>);

//Transform the data and send the output to the destination
xslt.Transform(mydata,null,writer, null);

Regards,

Bennie

"Miki Szinegh" <zs******@sympatico.ca> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello All,
I have an asp.net search application that brings up a datagrid of results,
with one of the fields being a hyperlink to an XML document, of which there are thousands. By clicking this link, the browser loads the XML document in its raw form.
My question is, how do I use some of these formatting techniques (XSL etc)
to format this XML the way I want to, after the link is clicked on?

A nudge in the right direction would be appreciated, as I can't seem to
find any example of what I am doing.

Thanks
Miki

Nov 12 '05 #2
Thanks Bennie, for the information. I guess I need to clarify some more what
I'm trying to do.
I need to somehow grab the file location from the Hyperlink that the user
clicks on and feed that to the XPathDocument. Bear in mind that the actual
filename of the XML document I need to format comes as a result of the user
selecting a particular file in my application.

Thanks again, I'm still trying to wrap my head around the XML/XSL etc stuff,
I have not used this before.

Miki
<ha*****@bellsouth.net> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl...
HI Miki,

You should be able to use the XslTransform class.
Below is an example

XslTransform xslt = new XslTransform();

//Load the stylesheet.
xslt.Load("http://server/YourXSLFileHere.xsl");

//Create a new XPathDocument and load the XML data to be transformed.
XPathDocument mydata = new XPathDocument("inputdata.xml");

//Create an XmlTextWriter which outputs to the console.
XmlWriter writer = new XmlTextWriter(<Output file or Response Stream Here>);
//Transform the data and send the output to the destination
xslt.Transform(mydata,null,writer, null);

Regards,

Bennie

"Miki Szinegh" <zs******@sympatico.ca> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello All,
I have an asp.net search application that brings up a datagrid of results, with one of the fields being a hyperlink to an XML document, of which

there
are thousands. By clicking this link, the browser loads the XML document

in
its raw form.
My question is, how do I use some of these formatting techniques (XSL etc) to format this XML the way I want to, after the link is clicked on?

A nudge in the right direction would be appreciated, as I can't seem to
find any example of what I am doing.

Thanks
Miki


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Nige | last post by:
I'm a complete novice to JS. I want to insert the date and time into a document in the format: WB-MMDDHHmm Where: WB- is a fixed string prefix (the whole string is a reference number) MM...
6
by: Ot | last post by:
I have an xml document similar to this <all> <one> <options attr1="1" attr2="2" /> <item name="a name" attr1="1" /> <item name="another" attr1="2"/> </one> <two> <options attr1="1"...
1
by: Riko Eksteen | last post by:
Hi I'm reading an xml file into an XmlDocument, adding some nodes, and writing it back out. I would like the nodes I add to assume the same level of indeting as the rest of the document. (I load...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
3
by: Urs Vogel | last post by:
Hi When using the XmlDocument.OuterXml property after adding some nodes and attributes, it returns the entire document correctly, but it's actually all on one line. How can I format the document...
4
by: Arthur Dent | last post by:
Hello all, ive been programming with ASP.NET since it came out, but am just getting my feet with now with v.2. Ive noticed something strange in the way my HTML tables get rendered with 2. I use...
2
by: rickholt | last post by:
Many years ago at IBM we had a text formatting language (DCF) which let you specify all sorts of microcommands to a page formatter. Not particularly exciting, but it was also a primitive...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
19
by: vunet.us | last post by:
Hello, My AJAX application paints data into about 500 cells with unique ID every 10 seconds. I am using document.getElementById() to find the right cell. However, I have noticed that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.