473,395 Members | 1,677 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,395 software developers and data experts.

Simple (?) question

Hi -

My experience with XML is limitted although I understand the basics,
and I just recently for the first time created an XML document from a
database query and styled it successfully with CSS.
I have the DTD and the XML included in one document, and the style
sheet is linked to.

(I would cut and paste the text here - but the damn server is down due
to the general incompetence of our network team and I have not backed
the database up locally . . . ).

The XML displays in the browser just fine (much to my delight and
amazement).

So far so good, but I now want to display the styled data in an html
document, and I don't know a simple way to do that. Do I have to write
a DTD that defines both the HTML and the unique XML that I intend to
style??? Can I include two DTD definitions (one for the HTML and one
for the XML) for one document??

It seems like this is doing too much work for such a seemingly common
application. Can someone please help??

Jul 20 '05 #1
4 1129


Tony G wrote:
So far so good, but I now want to display the styled data in an html
document, and I don't know a simple way to do that. Do I have to write
a DTD that defines both the HTML and the unique XML that I intend to
style??? Can I include two DTD definitions (one for the HTML and one
for the XML) for one document??


To render a HTML document or an XML document the browser needs a
stylesheet but not DTD (well for a HTML document there is not
necessarily a need for a stylesheet at all) so I am not sure why you ask
about the DTD if you want to render your XML data.
As for including the XML data in an HTML document does an HTML iframe
not work for you e.g.
<iframe src="whatever.xml" width="100%" height="300"></iframe>
?

Other approaches are possible but might be browser dependent unless you
solve anything on the server e.g. with ASP or PHP you convert/transform
your XML into some HTML (a list or a table for instance) and simply
include it in the main HTML document which you send to the browser.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
Thanks . . .

I just realized that the DTD was redundant w/ CSS styling. But can I
just then eliminate the DTD and put the <?xml version="1.0"
encoding="ISO-8859-1"?> &
<?xml-stylesheet type="text/css" href="stylesheet.css"?> directly into
the <body> of the html document?

(I would have done this by now if the damn server would come up!!!>

Or, without the need for a DTD, is it the opposite? Maybe I can just
put the <html> etc between the <?xml. . . tags.

What is the "normal" practise?

Thx

Tony

Jul 20 '05 #3


Tony G wrote:

I just realized that the DTD was redundant w/ CSS styling. But can I
just then eliminate the DTD and put the <?xml version="1.0"
encoding="ISO-8859-1"?> &
<?xml-stylesheet type="text/css" href="stylesheet.css"?> directly into
the <body> of the html document?

(I would have done this by now if the damn server would come up!!!>

Or, without the need for a DTD, is it the opposite? Maybe I can just
put the <html> etc between the <?xml. . . tags.


As I said your best bet is do use server side processing in the
language/framework of your choice (e.g. ASP or PHP or JSP for instance)
to build a complete HTML document with your XML data transformed and
included as appropriate HTML (e.g. a list or table).
That way you can choose a document type like HTML 4 and a Content-Type
like text/html that is well understood and rendered by older and newer
and potential future browsers whereas rendering of XML styled with CSS
has poor support and any techniques or attempts to combine HTML and XML
have even poorer support.

Unless you only need to support a particular browser like Mozilla for
instance which has good support for XML styled with CSS and support for
compound documents with elements from different namespaces I don't think
there is any way to simply combine your HTML and XML. With Mozilla you
could use an XHTML document served as application/xhtml+xml or
application/xml where you combine XHTML with your XML and use CSS to
style both.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #4
RC
Tony G wrote:
So far so good, but I now want to display the styled data in an html
document, and I don't know a simple way to do that. Do I have to write
a DTD that defines both the HTML and the unique XML that I intend to
style??? Can I include two DTD definitions (one for the HTML and one
for the XML) for one document??


Not quite understand what you need.

CSS for XML file is
<?xml-stylesheet type="text/css" href="your_filete.css" ?>

CSS for HTML file is

<html><head><title>Your HTML Title</title>

<STYLE TYPE="text/css">
@import url(your_file.css);
</STYLE>

Or

<LINK REL="stylesheet" TYPE="text/css" HREF="your_file.css" />

</head><boby>
....
</body></html>
Jul 20 '05 #5

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

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
1
by: Proteus | last post by:
Any help appreciated on a small perl project I need to write for educator/teaching purposes. I have not programmed perl for some time, need to get up to speed, maybe some kind souls hrere will help...
2
by: Raskolnikow | last post by:
Hi! I have a very simple problem with itoa() or the localtime(...). Sorry, if it is too simple, I don't have a proper example. Please have a look at the comments. struct tm *systime; time_t...
3
by: Peter | last post by:
Hello Thanks for reviewing my question. I would like to know how can I programmatically select a node Thanks in Advanc Peter
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
4
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
14
by: Giancarlo Berenz | last post by:
Hi: Recently i write this code: class Simple { private: int value; public: int GiveMeARandom(void);
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
10
by: Phillip Taylor | last post by:
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm having some trivial issues. In Visual Studio I create a web services project and change the asmx.vb file to this: Imports...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.