This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Including raw HTML (highlighted code)


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/.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]