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] Re: Linux Weekly News: A quick look at Conglomerate0.70


On Tue, 16 Sep 2003, Steinar Bang wrote:

> >>>>> "Robert P. J. Day" <rpjday@mindspring.com>:
> 
> [snip! pidgin docbook]
> > ..., although i'm well aware that, when it comes to selling into the
> > enterprise, this wouldn't be a good selling tool. :-)
> 
> Quite. ;-)
> 
> How much work is it to keep your pidgin docbook in sync with real
> DocBook?  Are you the only user of this format?

AFAIK, yes.  all it is is a pre-processing XSLT transformation, to
change things like 

<p> -> <para>
<s> -> <section>
<ft> -> <firstterm>

and so on.  the stylesheet is just a file full of templates like:

<xsl:template match="em">
 <emphasis>
 <xsl:apply-templates select="@*|node()"/>
 </emphasis>
</xsl:template>

and i don't even have to dream up abbreviations for every docbook
element.  if i don't define an abbreviation, then i just have to use
the full name.  i don't even have to explicitly type in that first
stylesheet, i let a shell script create it for me, it's at the bottom
of this posting.

really, there's nothing fancy about this, and it doesn't change any
of the rules for docbook processing, it just adds an extra step to 
the beginning allowing me to be lazy.

rday

here's the shell script to create the pre-processing stylesheet:

#!/bin/sh

cat << EOF
<?xml version='1.0' encoding='utf-8'?>

<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
	version="1.0">

<xsl:output
	version="1.0"
	encoding="utf-8"
	method="xml"
	indent="yes"
	doctype-public="-//OASIS//DTD DocBook XML V4.2//EN"
	doctype-system="http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd";
/>

<xsl:template match="comment() | processing-instruction()">
 <xsl:copy/>
</xsl:template>

<xsl:template match="@* | node()">
 <xsl:copy><xsl:apply-templates select="@* | node()" /></xsl:copy>
</xsl:template>

EOF

ABBS=":"

while read ELT ABB rest ; do

	case $ELT in 
		\#*)	continue ;;
	esac

	case $ABBS in
		*:$ABB:* ) echo "Dup $ABB, exiting." >&2 ; exit 2 ;;
		*)	 ABBS=":$ABB$ABBS"
	esac

	printf "<xsl:template match=\"$ABB\">\n"
	printf " <$ELT>\n"
	printf " <xsl:apply-templates select=\"@*|node()\"/>\n"
	printf " </$ELT>\n"
	printf "</xsl:template>\n"
	printf "\n"
done <<EOF
######################################################
# Misc
######################################################
beginpage	bp
bridgehead	bh
######################################################
# Block
######################################################
book		bk
chapter		ch
abstract	abs
section		s
section		se
simplesect	ss
title		t
title		ti
######################################################
# Paragraphs
######################################################
para		p
para		pa
simpara		spa
formalpara	fpa
######################################################
# Generic inline markup
######################################################
abbrev		ab
acronym		ac
emphasis	em
firstterm	ft
foreignphrase	fp
phrase		ph
quote		qu
wordasword	ww
######################################################
# Admonitions
######################################################
note		no
tip		tp
caution		ca
important	im
warning		wa
######################################################
# Blockquotes and epigraphs
######################################################
blockquote	bq
attribution	at
epigraph	ep
sidebar		sb
highlights	hl
######################################################
# Literallayout
######################################################
literallayout	ll
######################################################
# Lists
######################################################
itemizedlist	il
listitem	li
orderedlist	ol
simplelist	sl
member		me
variablelist	vl
varlistentry	ve
term		tm
#
procedure	proc
step		st
substeps	sst
#
qandaset	qa
qandaentry	qe
question	q
answer		a
######################################################
# Computer inline
######################################################
command		c
command		cm
option		op
synopsis	syn
optional	opl
#
filename	f
filename	fn
varname		vn
envar		ev
application	ap
constant	cn
literal		lt
email		eml
prompt		pr
userinput	ui
replaceable	re
computeroutput	cout
systemitem	si
ulink		uk
######################################################
# Verbatim code environments
######################################################
programlisting	pl
screen		sc
lineannotation	la
######################################################
# Mice and keys
######################################################
mousebutton	mb
keycombo	kcm
keycap		kcp
keysym		ksm
keycode		kcd
######################################################
# Figures
######################################################
figure		fg
graphic		gr
######################################################
# Mediaobjects
######################################################
mediaobject	mo
imageobject	io
imagedata	id
caption		cp
######################################################
# Tables
######################################################
table		ta
tgroup		tg
tbody		tb
colspec		cs
thead		th
row		row
entry		en
######################################################
# Linking
######################################################
link		lk
xref		xr
anchor		an
olink		ok
EOF

printf "</xsl:stylesheet>\n"



To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org.


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