473,473 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

*Very* basic XML/XSL question...

Tom
Hey all,

I've been planning to get myself started with DocBook for quite some
time now, so when I unexpectedly encountered a task for which DocBook
might actually be very useful, I thought I'd no longer wait.

Some Googling pointed me to several beginner tutorials, and I chose to
get myself going with the guide at

http://rzserv2.fhnon.de/%7Elg002556/docbuch/

However, as soon as I hit the very first example, my enthusiasm quickly
faded away, since I can't get it to work properly, "as advertised", so
to say. The tutorial is in German, but that doesn't matter: at 1.2, the
reader is shown a really basic xml file, referring to some docbook.xls
file for it's styling. A screenshot shows what the result should look
like in a browser.

The author puts this in his xml file

<?xml-stylesheet type="text/xsl"
href="file://C:/x/docbookxsl/docbook-xsl-1.55.0/xhtml/docbook.xsl" ?>

I don't run Windows, so on my machine, the path to that xsl file
is /usr/share/xml/docbook/stylesheet/nwalsh/xthml/docbook.xsl. I've
tried every possible way to link to it from the xml file (file:///,
just /usr/..., climbing up the tree like ../../../....., in the end I
even put the whole docbook tree next to the file), but nothing works
(and yes, the file is readable by regular users). All I get is plain
tags. I fiddled around with the mimetype too (text/xml, text/xsl,
application/xml, application/xml+xsl) and tried serving it with apache,
all too no avail. On IRC, some kind people pointed me to some more
general, i.e. not specificly DocBook-related tutorials, which I
definitely plan to go through.

But still, I was wondering if I've got this straight: the data one
describes using XML, dictated by a DocBook DTD, should be *styled* by
an xsl file, right? Why, then, doesn't the above example, used in a
DocBook tutorial from someone who seems to know a lot about it, seem to
work? Wouldn't it be obvious what purposes a file called "docbook.xsl",
inside a directory called "xhtml", that is somewhere in a tree
underneath "stylesheets", could possible serve?

I'm a little confused, and since no-one on IRC could give me any direct
clue about it, I'm hoping the question is not *that* superfluous. I
apologize sincerely if it was.

Greets,
Tom

--
"Mongolian drivers do not care much about pedestrians."
--
np: Welle: Erdball - Die Moorsoldaten (flac)

Jul 20 '05 #1
9 3267
This example was probably intended to be run under MS Internet
Explorer. The xml-stylesheet directive tells the parser that this XML
doc should be transformed using the XSL doc indicated (note that XSL
transforms one XML document into a different XML document - it doesn't
simply 'style' it. In this case, it is probably transforming plain
XML into docbook format). If you are running the XML through a parser
that doesn't recognise the xml-stylesheet directive, they you won't
get the transformation. I suggest that you do the transformation
manually for each example. There are tons of tools around that will
allow you to do it from the command line.
Tom <tom @ abwaerts . be> wrote in message news:<88****************@zukunft.mine.nu>...
Hey all,

I've been planning to get myself started with DocBook for quite some
time now, so when I unexpectedly encountered a task for which DocBook
might actually be very useful, I thought I'd no longer wait.

Some Googling pointed me to several beginner tutorials, and I chose to
get myself going with the guide at

http://rzserv2.fhnon.de/%7Elg002556/docbuch/

However, as soon as I hit the very first example, my enthusiasm quickly
faded away, since I can't get it to work properly, "as advertised", so
to say. The tutorial is in German, but that doesn't matter: at 1.2, the
reader is shown a really basic xml file, referring to some docbook.xls
file for it's styling. A screenshot shows what the result should look
like in a browser.

The author puts this in his xml file

<?xml-stylesheet type="text/xsl"
href="file://C:/x/docbookxsl/docbook-xsl-1.55.0/xhtml/docbook.xsl" ?>

I don't run Windows, so on my machine, the path to that xsl file
is /usr/share/xml/docbook/stylesheet/nwalsh/xthml/docbook.xsl. I've
tried every possible way to link to it from the xml file (file:///,
just /usr/..., climbing up the tree like ../../../....., in the end I
even put the whole docbook tree next to the file), but nothing works
(and yes, the file is readable by regular users). All I get is plain
tags. I fiddled around with the mimetype too (text/xml, text/xsl,
application/xml, application/xml+xsl) and tried serving it with apache,
all too no avail. On IRC, some kind people pointed me to some more
general, i.e. not specificly DocBook-related tutorials, which I
definitely plan to go through.

But still, I was wondering if I've got this straight: the data one
describes using XML, dictated by a DocBook DTD, should be *styled* by
an xsl file, right? Why, then, doesn't the above example, used in a
DocBook tutorial from someone who seems to know a lot about it, seem to
work? Wouldn't it be obvious what purposes a file called "docbook.xsl",
inside a directory called "xhtml", that is somewhere in a tree
underneath "stylesheets", could possible serve?

I'm a little confused, and since no-one on IRC could give me any direct
clue about it, I'm hoping the question is not *that* superfluous. I
apologize sincerely if it was.

Greets,
Tom

--
"Mongolian drivers do not care much about pedestrians."

Jul 20 '05 #2
Tom
[Sunday 29 February 2004 23:50] Matt in comp.text.xml:
This example was probably intended to be run under MS Internet
Explorer. The xml-stylesheet directive tells the parser that this XML
doc should be transformed using the XSL doc indicated (note that XSL
transforms one XML document into a different XML document - it doesn't
simply 'style' it. In this case, it is probably transforming plain
XML into docbook format).
Hey hey... I think you managed to make it clear to me what I was trying
to do and why it didn't work.

Let me get this straight: the XML document one writes, using a DocBook
DTD, can be transformed to any kind of output document by means of
specific XSL documents, designed for the purpose? But what, then, is
"DocBook"? Just a bunch of predescribed tags, that can be used to
efficiently write documentation of many kinds?
If you are running the XML through a parser
that doesn't recognise the xml-stylesheet directive, they you won't
get the transformation. I suggest that you do the transformation
manually for each example. There are tons of tools around that will
allow you to do it from the command line.


Yes, thanks.

Still, I wonder: why, then, did the example obviously work in Internet
Explorer, and not in Mozilla, Konqueror, or whatever browser I tried?
Is that determined by some browser-specific XML parser, which, in the
case of IE, managed to interpret the stylesheet on the fly?

Greets, and many thanks,
Tom

--
"Mongolian drivers do not care much about pedestrians."
--
np: gar nix

Jul 20 '05 #3
In article <28****************@zukunft.mine.nu>, Tom <to*@verbreyt.be> wrote:

% specific XSL documents, designed for the purpose? But what, then, is
% "DocBook"? Just a bunch of predescribed tags, that can be used to
% efficiently write documentation of many kinds?

Not `Just a bunch', but `A bunch'.

% Still, I wonder: why, then, did the example obviously work in Internet
% Explorer, and not in Mozilla, Konqueror, or whatever browser I tried?

If it didn't work in Mozilla, it may be that the stylesheet doesn't
use the correct URL for the name space prefix. IE accepts two -- the
correct one, http://www.w3.org/1999/XSL/Transform, and another one
which only it accepts. There are many browsers out there, of which
only some can handle xslt.

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #4
XML directives (tags starting with <?) are not actually a part of the
XML document, but are instructions to the parser. In this case, the
instruction to the parser is to transform the document with the given
XSL doc. Directives rely on the parser recognising them, and off the
top of my head, I think the only directive that a parser MUST
recognise is <?xml ...?>. If a parser doesn't recognise a directive,
it just ignores it. I think (and may be wrong) that IE is the only
browser that supports the stylesheet directive.

I hope this makes things clearer for you.

Matt

pt**@interlog.com (Patrick TJ McPhee) wrote in message news:<c1**********@news.eusc.inter.net>...
In article <28****************@zukunft.mine.nu>, Tom <to*@verbreyt.be> wrote:

% specific XSL documents, designed for the purpose? But what, then, is
% "DocBook"? Just a bunch of predescribed tags, that can be used to
% efficiently write documentation of many kinds?

Not `Just a bunch', but `A bunch'.

% Still, I wonder: why, then, did the example obviously work in Internet
% Explorer, and not in Mozilla, Konqueror, or whatever browser I tried?

If it didn't work in Mozilla, it may be that the stylesheet doesn't
use the correct URL for the name space prefix. IE accepts two -- the
correct one, http://www.w3.org/1999/XSL/Transform, and another one
which only it accepts. There are many browsers out there, of which
only some can handle xslt.

Jul 20 '05 #5
Matt (comp.text.xml:60416):
XML directives (tags starting with <?) are not actually a part of the
XML document, but are instructions to the parser. In this case, the
instruction to the parser is to transform the document with the given
XSL doc. Directives rely on the parser recognising them, and off the
top of my head, I think the only directive that a parser MUST
recognise is <?xml ...?>. If a parser doesn't recognise a directive,
it just ignores it.


Well, not quite. The XML spec does not specify at all what parsers
should return, only what they accept. Some parsers may return processing
instructions.

Now, you also have document models, such as XPath's. And as a matter of
fact, processing instructions *are* part of this document model (so you'd
better use a parser that returns processing instructions to
"load" this document model...). Btw, the same applies to comments: it's
possible to write an XSLT stylesheet whose result depends on the content
of some comment in the input document. XML is a wonderful world ;-)
Jul 20 '05 #6
In article <e0**************************@posting.google.com >,
Matt <ma**@realdevelopments.com.au> wrote:

% XML directives (tags starting with <?) are not actually a part of the
% XML document, but are instructions to the parser.

OK, but Mozilla understands the xsl-stylesheet PI, so, in the absence of
more accurate information, we are free to speculate on the reasons
Mozilla might not be transforming the document -- one possible reason
would be a stylesheet which doesn't use the correct name space
declaration. A useful, informative, follow-up to my posting would have
told us the declaration that IE accepts but no other XSLT processor
does. Perhaps we'll have one of those tomorrow.
--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #7
"Patrick TJ McPhee" <pt**@interlog.com> wrote in message news:c2**********@news.eusc.inter.net...
OK, but Mozilla understands the xsl-stylesheet PI,
It's the xml-stylesheet PI, and it's been a W3C Recommendation
for close to five years,

http://www.w3.org/TR/xml-stylesheet/

although IE and Mozilla are the only two browsers I know of that
have any sort of implementation for this.
A useful, informative, follow-up to my posting would have
told us the declaration that IE accepts but no other XSLT processor
does.


You don't mean,

http://www.w3.org/TR/WD-xsl

do you? There's nothing Microsoft-specific about it; it was just the old
XSL namespace URI when it was still a Working Draft. MSXML accepts
it for compatibility with legacy stylesheets that do not require XSLT 1.0
conformance.
Derek Harmon
Jul 20 '05 #8
In article <c2*************@ID-185805.news.uni-berlin.de>,
Derek Harmon <lo*******@email.msn.com> wrote:
% "Patrick TJ McPhee" <pt**@interlog.com> wrote in message
% news:c2**********@news.eusc.inter.net...
% > OK, but Mozilla understands the xsl-stylesheet PI,
%
% It's the xml-stylesheet PI, and it's been a W3C Recommendation
% for close to five years,

Oops -- sorry. wrt to browser support, there's nothing wrong with not
understanding any PI at all, but when you're diagnosing a problem, you
need to know whether the tools you use do understand the PIs you're
using.

% You don't mean,
%
% http://www.w3.org/TR/WD-xsl
%
% do you? There's nothing Microsoft-specific about it; it was just the old
% XSL namespace URI when it was still a Working Draft. MSXML accepts

I didn't say it was Microsoft-specific. I said that only IE accepts it.
I guess we could expand it to include any browser or other tool that
uses MSXML. The question here is why something works in IE, but not in
other browsers. The most obvious reasons are that the other browsers
don't provide xslt (but we know Mozilla does), and that IE accepts a
stylesheet name space declaration that other XSLT processors don't.

To the OP, if you have something like

<xsl:stylesheet xmlns:xsl='http://www.w3.org/TR/WD-xsl' ...>

then change it to

<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' ...>

and you may find it works with Mozilla, and any other browsers that
support XSLT, as well as IE.

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #9
Tom
[Tuesday 02 March 2004 17:51] Patrick TJ McPhee in comp.text.xml:

<snip>

A little late, but thanks to all. I'm still trying to get the big
picture, but I'm sure I'll get the hang of it. Eventually. :-)

Greets,
Tom

--
"Mongolian drivers do not care much about pedestrians."
--
np: Lapsed - Twilight (13) (flac)

Jul 20 '05 #10

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

Similar topics

30
by: Vla | last post by:
why did the designers of c++ think it would be more useful than it turned out to be?
5
by: Lee David | last post by:
I went to the sun site and downloaded what I hope is the development part of java. I downloaded JDK5 with Netbeans. I installed it and now have a folder in my program group "Netbeans". Is that...
10
by: Jason Curl | last post by:
Greetings, I have an array of 32 values. This makes it extremely fast to access elements in this array based on an index provided by a separate enum. This array is defined of type "unsigned long...
6
by: msnews.microsoft.com | last post by:
Hello All, I am very new to ASP.NET and I have a basic question. Can somebody please explain? I have an .aspx Web Page with a textbox control. When the Page initially loads I am calling a...
8
by: pamelafluente | last post by:
Hi, I would like to get some advice. I know enough vb.net on win apps, but I have never worked on web applications and asp.net. I would appreciate if you could indicate the most basic...
6
by: aghazalp | last post by:
hi guys, this would be the most basic question ever...I am not a programmer but I am trying to learn programming in python...I was reading John Zelle's text book and instructed me to make .py file...
17
by: blueapricot416 | last post by:
This is a very basic question -- but I can't find the answer after looking for 20 minutes. If you code something like: function set_It() { setTimeout('Request_Complete("apple", -72)',5000) }...
7
by: Bruno43 | last post by:
Hi I am trying to learn Visual Basic and I am getting everything for the most part, mainly because of my ability to read code like a book, but my question is what is the best way to Navigate through...
56
by: mdh | last post by:
As I begin to write more little programs without the help of the exercises, little things pop up that I need to understand more fully. Thus, below, and although this is not the exact code, the...
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,...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.