This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] Including raw HTML (highlighted code)
- From: "Bob Stayton" <bobs at sagehill dot net>
- To: "Claus Rasmussen" <cra at web500 dot com>,<docbook-apps at lists dot oasis-open dot org>
- Date: Wed, 14 Jan 2004 10:46:29 -0800
- Subject: Re: [docbook-apps] Including raw HTML (highlighted code)
- References: <41B1F3824343174FBDE97F5033F08BA482A505@venus.web500.com>
I have found a way to do this if your included HTML is
XHTML.
1. Put something like this in your DocBook document:
<programlisting role="rawhtml">
<textobject>
<textdata fileref="test.html"/>
</textobject>
</programlisting>
2. Add something like this to your XSL customization layer:
<xsl:template match="programlisting[@role='rawhtml']">
<xsl:variable name="inputfile">
<xsl:value-of select="textobject/textdata/@fileref"/>
</xsl:variable>
<xsl:variable name="rawhtml" select="document($inputfile,.)"/>
<pre>
<xsl:copy-of select="$rawhtml"/>
</pre>
</xsl:template>
This template will be applied only when a programlisting
has a role="rawhtml" attribute. It gets the filename from
the textobject's textdata child, reads the content of
the file (which must be XML) into a variable, and then
copies the variable's content to the output inside of
an HTML <pre> element.
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
----- Original Message -----
From: "Claus Rasmussen" <cra@web500.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, January 14, 2004 2:13 AM
Subject: [docbook-apps] Including raw HTML (highlighted code)
Hi folks,
Is there any way for me to just include raw text (HTML) in my DocBook
output? I'm using the XSL style sheets to generate XHTML and HTML Help
files, so it doesn't matter that a PDF production would choke on
whatever solution I come up with.
I'm including code samples from external files, which is all well and
good. But I would love for my code samples to be syntax highlighted, so
I'm running them through another process that spits out styled HTML that
displays the code in nicely highlighted format.
Anyone?
/claus
To unsubscribe from this list, send a post to
docbook-apps-unsubscribe@lists.oasis-open.org, or visit
http://www.oasis-open.org/mlmanage/.
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.