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] Current date?


On Wed, Apr 02, 2003 at 12:48:18PM +0200,
 Mailing List <mailinglist dot 01 dot 1 at goolo dot com> wrote 
 a message of 30 lines which said:

> * declare this file as an entity:
> 
> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "docbookx.dtd" [
> ...
> <!ENTITY timestamp SYSTEM "timestamp.txt">
> ...
> ]>
> 
> 
> * and use it
> ...
> <pubdate>&timestamp;</pubdate>

And to be sure that the timestamp file will be a true reflection of
the reality, use make. Here is an example with GNU make:

# ts = TimeStamp
%.html: %.xml %.ts example.xslt
	xsltproc example.xslt  example.xml > $@

%.ts: %.xml
	ls -l $< | awk '{print $$6 " " $$7 " " $$8}' > $@
	# To have a nicer presentation of date, see 
	# http://developers.cogentrts.com/cogent/prepdoc/pd-latestdate.html
	# Replace 'ls -l' by 'date' if you are interested in the
	# current date, not in the date of the file.

You can also include the timestamp from from the XSL stylesheet, if
you do not want to bang your authors on the head "Thou shalt include a
<PUBDATE>!!!". 

<?xml version='1.0'?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY timestamp SYSTEM "general.ts">
]>

  <xsl:template match="text">
    <xsl:apply-templates/>
    <xsl:text>&#10;</xsl:text>
    <xsl:text>The original file was modified on &timestamp;</xsl:text> 
  </xsl:template>

The Makefile becomes:

%.html: %.xml example.xslt
	ls -l $< | awk '{print $$6 " " $$7 " " $$8}' > general.ts
	sabcmd example.xslt  example.xml > $@

.PHONY: general.ts

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe at lists dot oasis-open dot org
For additional commands, e-mail: docbook-apps-help at lists dot oasis-open dot org


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