473,320 Members | 2,110 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,320 software developers and data experts.

Transform XML to HTML only for Browsers

Hi Folks,
Beg pardon for this simplistic question (I've searched via Google but got
lost with all the terminology).

An application I have created dumps out some data in XML format to a file.

I want the file to remain unchanged so that other applications can open
it and read the data contained in there.

But, if someone points a browser at the file I want the XML file to be
transformed via an XSLT script into HTML so that it looks pretty on the screen
instead of collections of angled-bracketed data lumps.

So the transform only occurs when some browser looks at the file; any other
program looking at the file will see only plain XML.

Can this be engineered?

Any help appreciated; thanks in advance

Mungo Henning
Jul 20 '05 #1
6 3816
Using XSLTs to transform you XML to HTML will require a server side
engine like Cocoon to perform the transformation. You can instead
use a CSS to perform the transformation.

Here are some links with more information on this:

http://www.xml-dev.com/blog/#18
http://www.w3.org/TR/xml-stylesheet/

e.g.
http://unadorned.org/waspchump/xml/index.xml

In Peace
Saqib Ali
http://validate.sf.net
Jul 20 '05 #2
one more interesting site:

http://www.badgers-in-foil.co.uk/projects/docbook-css/

In Peace,
Saqib Ali
http://validate.sf.net
Jul 20 '05 #3
Mungo Henning wrote:
An application I have created dumps out some data in XML format to a file.

I want the file to remain unchanged so that other applications can open
it and read the data contained in there.

But, if someone points a browser at the file I want the XML file to be
transformed via an XSLT script into HTML so that it looks pretty on the screen
instead of collections of angled-bracketed data lumps.

So the transform only occurs when some browser looks at the file; any other
program looking at the file will see only plain XML.


You may take a look at the HTTP Accept header. If the requesting user
agent wants text/html, you perform the transformation, otherwise send
the raw XML. And make sure that the 'other applications' don't order
text/html in the Accept header.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Jul 20 '05 #4
Mungo Henning wrote:
Hi Folks,
Beg pardon for this simplistic question (I've searched via Google but got
lost with all the terminology).

An application I have created dumps out some data in XML format to a file.

I want the file to remain unchanged so that other applications can open
it and read the data contained in there.

But, if someone points a browser at the file I want the XML file to be
transformed via an XSLT script into HTML so that it looks pretty on the screen
instead of collections of angled-bracketed data lumps.

So the transform only occurs when some browser looks at the file; any other
program looking at the file will see only plain XML.

Can this be engineered?


Recent versions of Internet Explorer and Netccape/Mozilla can render XML
contents with CSS or XSL stylesheets. So simply create an adequate
stylesheet and put a reference to it in your XML documents. The
documents will be nicely displayed in these browsers.
--
To reply by e-mail, please remove the extra dot
in the given address: m.collado -> mcollado

Jul 20 '05 #5
In article <de*************************@posting.google.com> ,
ru********@gmail.com writes:
Using XSLTs to transform you XML to HTML will require a server side
engine like Cocoon to perform the transformation.


No need for anything so heavyweight as cocoon. See for example
http://www.outoforder.cc/projects/apache/mod_transform/

I offer users choice of format for XML reports. So
http://my.server/reports/foobar <=== raw XML
http://my.server/reports/foobar.html <=== HTML for browsers
http://my.server/reports/foobar.rdf <=== semweb

--
Nick Kew

Nick's manifesto: http://www.htmlhelp.com/~nick/
Jul 20 '05 #6
> No need for anything so heavyweight as cocoon. See for example

Yea there are many other lightweight solutions like AxKit, and other
PHP based apps that can do the trasnformation. But they all require
extra server component etc.

Using CSS to display the contents in a browser, does not require any
serverside add-ons.

In Peace,
Saqib Ali
http://validate.sf.net
Jul 20 '05 #7

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

Similar topics

2
by: AndreFlash7 | last post by:
Hello All, Is it possible to call a XML document that has been transform with XSL from within a HTML page. I know XSL allows you to do the HTML codes/format but I already have template in a...
7
by: Peter | last post by:
I have noticed a difference in the processing of XSL transforms between dotnet and MSXML. Dotnet formats the resulting output differently, and since we use the <pre> tag in the HTML output it makes...
2
by: N. Demos | last post by:
I'm having problems with a custom JS object (XMLLoadObject) I designed to load XML and XSL files, perform an XSL transform with them and embed the resultant HTML fragment into the host HTML...
5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
3
by: Martin Olson | last post by:
I'm trying to output valid xhtml 1.0 transitional with xslt -- my question is when dealing with elements that have self-closing tags such as <img /> and <input />... I'm getting closing tags on...
5
by: Daniel Jung | last post by:
Hi all Stumbled on a weird thing. The text input object inherits the parent's CSS text-transform rule in OPERA (8.51). In IE (6.0) and FF (1.0.7), it doesn't. Why is that? Minimal test case:...
6
by: Vijai Kalyan | last post by:
Hello, I am trying to use std::transform to take in a collection of strings, transform them and insert the result into an output container. So, I wrote something like this: std::wstring...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
1
by: patrickbeaudoin | last post by:
Hi, I have a problem when I put the <htmltag in to a xsl transformtion. First, I give you a xml and xsl example: XML: <form title="Test" height="600" width="800"> <element type="check">...
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: 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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.