DITA and XMetaL Discussion
IF September 24, 2010 at 5:41 pm
displaying date output is generatedSeptember 24, 2010 at 5:41 pmParticipants 5Replies 6Last Activity 11 years, 9 months ago
In XMetal 6.0, is there a way to display in the output (HTML or XMetal Enhanced PDF via Render XEP) the date/time on which the output was generated? Thanks.Derek Read September 24, 2010 at 8:35 pm
Reply to: displaying date output is generatedSeptember 24, 2010 at 8:35 pm
The date and time of production can be viewed (in Adobe Reader anyway) by opening the Document Properties dialog. I assume what you really want is to include this information somewhere directly within the visible portion of the PDF (and HTML). Can you elaborate on where you want this information to appear and what date/time format you wish it to be in?
Two different source for the date/time I can think of and it isn't clear which you want:
1. Hard-code the date into your map (or topic) using the elements DITA provides for this, then adjust the DITA OT transformation to extract this information and place it in the location you wish it to appear in your output. Maybe something like this:
A date attribute is also present on the following elements:
(this is the most likely one to use depending on what you are after)
and appear inside various elements that give more context, like , , etc.
A year attribute is present on the following elements:
2. Modify the DITA OT in some way to obtain the date/time from the system (and again, insert it into the document somewhere). This would better reflect the actual time of “printing”. There are apparently some extensions to XSLT that provide date and time functions, however, I have not used these. I'm not sure if they will work with all XSLT processors either.IF September 27, 2010 at 8:43 pm
Reply to: displaying date output is generatedSeptember 27, 2010 at 8:43 pm
The scenario in option 1 is what I was thinking. So basically, my question becomes: how do I show the value of
in the PDF output?
Thanks. IsabelleDerek Read September 28, 2010 at 12:50 am
Reply to: displaying date output is generatedSeptember 28, 2010 at 12:50 am
There's not quite enough detail here to give you an explicit answer but one way to do this might be to define a new parameter:
Then insert this where you want to insert it using $documentCreatedDate. So, for example, if you wanted to have this appear in even (page numbered) footers inside the document body you could redefine the other parameters that are defined for that purpose:
If you were to put all of the code above into %appdata%SoftQuadXMetaL SharedDITA_OTdemoxmfoCustomizationfoxslcustom.xsl (which is where I would suggest you put any overrides) then you should see the value for the date attribute appear on evenly numbered pages inside the document “body” (as opposed to evenly numbered pages, or the TOC, Index, etc).
Note that as written above the XPath is specific to DITA Maps and is not “specialization savvy”.
If you want the value for this element's date attribute to show up on the cover page you could modify the xm_titlepage.xsl directly (or perhaps ideally, do an override like above, but instead to in which case you'd need to duplicate the entire template and then insert your new code into it).
You would be inserting something like the following into that template where you want the new content to appear (possibly after the “for-each” that inserts the subtitle):
I've reused xsl:use-attribute-sets="xm.titlepage.subtitle" for the styling here so that a new one doesn't need to be made up. You could create your own or use another one that already exists if you need this text to be styled differently.
Note that this XPath is specialization-savvy.IF September 28, 2010 at 10:56 pm
Reply to: displaying date output is generatedSeptember 28, 2010 at 10:56 pm
Thanks for the very detailed answer. I got this to work but best of all a light bulb went on and I finally understand how to make the rest of my required changes in order to get a PDF output I can live with.IF November 25, 2010 at 5:21 pm
Reply to: displaying date output is generatedNovember 25, 2010 at 5:21 pm
FYI – to close the loop
This is what I ended up doing for my draft documents:
In the footer, I have added a date that indicates when the output was generated, as per the instructions in http://forums.xmetal.com/index.php/topic,150.0.html
I also print the create date and revised dates found in the prolog of each topic using this template:
Topic created on:
gcrews November 25, 2010 at 5:55 pm
Reply to: displaying date output is generatedNovember 25, 2010 at 5:55 pm
For a pdf we use the EXSLT date and time functions.
I think it takes a little bit to get it working.
- You must be logged in to reply to this topic.