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?

Mailing List wrote:
> * generate a timestamp (this is a M$-DOS example)
> echo %date% %time% >timestamp.txt
> * 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>


If you are willing to rely on EXSLT support in the XSLT processor, you 
  could do like I did in our XSL-FO customization layer. It works with 
Saxon and xsltproc. Don't know about Xalan.

Here is what I did:

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

<!-- Note the xmlns:date="..." above -->

<!-- SNIP (Imports and other customizations) -->

      Template formatted for readability.
      May produce extra blanks.
      Add number formatting to ensure two digits in
      time fields.
   <xsl:template match="pubdate[@role='now']" mode="titlepage.mode">
     <xsl:variable name="now" select="date:date-time()"/>
       <xsl:text>Generated at </xsl:text>
       <xsl:value-of select="date:day-in-month($now)"/>
       <xsl:text> </xsl:text>
       <xsl:value-of select="date:month-name($now)"/>
       <xsl:text> </xsl:text>
       <xsl:value-of select="date:year($now)"/>
       <xsl:text> </xsl:text>
       <xsl:value-of select="date:hour-in-day($now)"/>
       <xsl:value-of select="date:minute-in-hour($now)"/>
       <xsl:value-of select="date:second-in-minute($now)"/>

<!-- ETC -->



<!DOCTYPE book PUBLIC "..." "...">

<book lang="en">
     <title>Blah blah/title>
     <pubdate role="now"/>
     <!-- ETC -->

<!-- ETC -->

Best regards,

	Rune Lausen

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