Display Ant property value in generated PDF
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 9
- Joined: Tue Sep 24, 2013 1:23 am
Display Ant property value in generated PDF
I am using a custom build script that holds the revision number of the documentation. I want to be able to build the PDF and have the revision number displayed on the front page.
What modifications do I need to be able to display an ANT property in the PDF document?
I managed to make it work for data values set in the ditamap i.e
But how to do it for an ANT property?
If this is not easy then adding the current date to the front page may be enough
Thanks
What modifications do I need to be able to display an ANT property in the PDF document?
I managed to make it work for data values set in the ditamap i.e
Code: Select all
ditamap:
<data name="revision" value="v1"
fo/xsl/custom.xsl:
<xsl:value-of select="$map/data[@name='revision']/@value"/>
If this is not easy then adding the current date to the front page may be enough
Thanks
-
- Posts: 9451
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Display Ant property value in generated PDF
Hi Nigel,
In my opinion the approach with having the release number in the DITA Map and then reading it in the XSLT code is a good approach (and easier to implement as well).
Anyway, if you want to have the parameter in the custom build file (which eventually calls the DITA OT build file), you would need to also specify that extra parameter to the ANT <xslt> task used to invoke the XSLT code which parses the merged XML document. Then in your custom.xsl you would declare the xsl:param and its value will come from the build files which invoke the XSLT code.
For example you can look in this build file:
OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/build.xml
at the XSLT task:
which sets a lot of parameters for the stylesheets. You would probably need to send one extra parameter, the one with the value specified in your custom build file.
Regards,
Radu
In my opinion the approach with having the release number in the DITA Map and then reading it in the XSLT code is a good approach (and easier to implement as well).
Anyway, if you want to have the parameter in the custom build file (which eventually calls the DITA OT build file), you would need to also specify that extra parameter to the ANT <xslt> task used to invoke the XSLT code which parses the merged XML document. Then in your custom.xsl you would declare the xsl:param and its value will come from the build files which invoke the XSLT code.
For example you can look in this build file:
OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/build.xml
at the XSLT task:
Code: Select all
<xslt style="${temp.transformation.file}" in="${dita.temp.dir}/stage1a.xml" out="${dita.temp.dir}/stage2.fo">
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9
- Joined: Tue Sep 24, 2013 1:23 am
Re: Display Ant property value in generated PDF
So I would have to change the files under Oxygen Framework, no way to override in customization directory?
Is it possible to get the Current Date / Time placed in the ditmap as a <data> value? In that every time that the document is built the value will be replaced with the current date / time, without the author needing to update the value. I could use that instead of a version number
Is it possible to get the Current Date / Time placed in the ditmap as a <data> value? In that every time that the document is built the value will be replaced with the current date / time, without the author needing to update the value. I could use that instead of a version number
-
- Posts: 9
- Joined: Tue Sep 24, 2013 1:23 am
Re: Display Ant property value in generated PDF
I noticed in the file you referenced there is a line
Could that be used in some way? i.e. point it to a file that is generated from the ANT script?
Code: Select all
<param name="variableFiles.url" expression="${variable.file.url}"/>
-
- Posts: 9
- Joined: Tue Sep 24, 2013 1:23 am
Re: Display Ant property value in generated PDF
Found a solution that works well. I have an xml file that I load into the custom xsl file. The xml file loads the values form a properties file that I generate from the ANT build file and then I can use the values as variables in the xsl file. No need to change any files in the framework directory.
Now to modify the webhelp output
Now to modify the webhelp output
-
- Posts: 9451
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Display Ant property value in generated PDF
Hi Richard,
Yes, that is an interesting approach as well, thanks for sharing it.
About this question:
Regards,
Radu
Yes, that is an interesting approach as well, thanks for sharing it.
About this question:
You could have generated the current date directly in the XSLT script using XSLT 2.0 functions like current-dateTime().Is it possible to get the Current Date / Time placed in the ditmap as a <data> value?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service