Re: (dsssl) Including chunks of HTML code (newbie)

Subject: Re: (dsssl) Including chunks of HTML code (newbie)
From: Brandon Ibach <bibach@xxxxxxxxxxxxxx>
Date: Wed, 10 Jul 2002 16:28:19 -0500
Quoting Antun Karlovac <antun@xxxxxxxxxxxxxxxxx>:
> It turns out I had the driver file all along, and had tried it, but with no
> luck. I actually run:
> 
>      "make html"
> 
> which seems to run:
> 
>      "openjade -i wdoclinks -V woutdoclinks=ignore -d 'laszlo.dsl#html' -t
> xml index.sgml"
> 
> laszlo.dsl being the driver file. Is this the same thing?
> 
   Right.  The driver file here is laszlo.dsl.  However, a specific
portion of that file is being singled out with the "#html" part of the
argument to the -d option.  You should find a line something like:

	<style-specification id="html" use="docbook">

in laszlo.dsl.  The code inside this tag is the stylesheet being used.
Any customizations you provide need to go inside of it.

> What I'm trying to output is not HTML tags, but PHP code, surrounded by
> "<?php" and "?>". Only don't think of it as tags. Just thing of it as a bit
> of text that has to go at the top/bottom of each page, IN PLACE OF the usual
> "<html><head><title......<body>" and "</body></html>".
> 
   The designers of PHP were smart.  The construct that is used to
embed PHP code in an HTML page is an XML "processing-instruction",
which looks like:   <?target blah,blah?>
   The "target" is an XML-ism to provide a little more structure to
PIs than SGML had.  XML also adds the question mark at the end (just
before the ">" sign), where SGML did not have this.  Because your
"make html" command is invoking the XML backend of OpenJade (the "-t
xml" option), you can use the following to produce PHP code:

	(make processing-instruction data: "php ...")

   You will need to take care with your PHP code (inserted in place of
the ..., above), as certain characters, mainly <, > and &, can cause
problems, depending upon how your stylesheet is structured, but I
think you touched on that already with a CDATA section.
   As for what code to override, you'll probably want to redefine the
html-document function from dbhtml.dsl (about 60 lines down in the
file, in my copy of Norm's stylesheets).  There's some kind of complex
stuff going on in this function with chunking (breaking the output
into multiple files), header generation, etc, so be careful. ;)

-Brandon :)

 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist

Current Thread