RE: [xsl] Building a Manual with XML/XSL

Subject: RE: [xsl] Building a Manual with XML/XSL
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 07 Sep 2003 09:15:04 -0400
At 2003-09-07 12:58 +0200, Iván Montoro Ten wrote:
Now I'm thinking if it's possible to make a
node know which depth do he have in the tree,

Yes, if you had <section> within <section> you can calculate depth and reflect the appropriate heading level in the HTML. I prefer to have nested sections than uniquely identified <sect1>, <sect2>, etc.

By "hard PDF" I mean I realy have no idea about which software do I need

Your XML is run through XSLT with an XSL-FO stylesheet to produce an instance of XSL-FO that is interpreted by an engine to produce PDF output.

(I've seen Apache Forrest do the work quite well, but time to R&D is not
in my budget)

But, respectfully, *learning* a technology only from asking questions on a maillist seems a bit inappropriate to me ... if you would first learn from the many books and tutorials that are available from many places, or attend a training course where the languages are taught, then you can use the mail list as a resource for getting help with specific problems.

I mentioned last message that we are teaching a public course in Europe this month (students brand new to XSL are producing HTML and PDF outputs from in class) and two other companies (not listed in any particular order) that have talented XSL trainers are:

  - Mulberry Technologies -
  - ISOGEN International -

Asking for concepts from the list helps to put these languages in perspective, but I think it is important for you to learn the languages off-list and then come to the list when you have problems with what you have learned. I don't mean to be disrespectful in this suggestion.

Using attributes as titles of my sections was just for an example. I have
not finished the XML structure yet

An excellent collection of opinions is maintained by Robin Cover at:

There you will see my opinion that language text is coerced into #PCDATA and machine text is coerced into attributes. I go to great lengths at times to enforce this in my structures.

Now, imagine I want this manual to be included in a PHP/JSP page. Is there
any easy way to exclude everything but the body in the resulting HTML? I
would like to have a third version of the manual: HTML, PDF and HTML for
includes inside my website (in the middle of a table, for example).

Vendors of XSLT engines provide extensions allowing you to produce multiple outputs. These output can be XML documents, XML external parsed general entities, HTML fragments or simple text.

I'm wondering also why xalan does not complain if I don't have a DTD/XSD
for my XML. Is not necessary?

Again, a *very* basic XML question. While SGML required a document model in order to interpret the markup being used, XML has sufficient syntactic constraints that a processor can fully interpret the hierarchical structure without the use of a document model. So to answer your question, yes, the DTD/XSD is not necessary.

And the last question, even less related to XSL: I want to make a little
script (shell script) to xalan all xml files in a directory structure.
As xalan needs the XSL file to apply to the XML I need to extract it from
the XML file. Anybody could tell me the regexp who could make this for me?
(I'm also open to any other parser suggestions)

I often utilize an XSLT structure to read my XML documents of filenames and synthesize shell scripts for subsequent execution, because the text output method produces files without any markup escaping, thus they can be safely interpreted by shells and command-line interpreters. No regexp is required, so perhaps I misunderstand your question.

Good luck in your learning of this technology ... you will find it very powerful.

................... Ken

Next public European delivery:  3-day XSLT/2-day XSL-FO 2003-09-22
Next public US delivery:        3-day XSLT/2-day XSL-FO 2003-10-13
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide:  please contact us for the details

G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                       Definitive XSLT and XPath
ISBN 0-13-140374-5                               Definitive XSL-FO
ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X               Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:
Male Breast Cancer Awareness

XSL-List info and archive:

Current Thread