OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Current date?


On Wed, Apr 02, 2003 at 12:48:18PM +0200,
 Mailing List <mailinglist.01.1@goolo.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


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]