Using a custom parameter in a Publishing Template?
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 31
- Joined: Sat Jan 17, 2015 6:21 pm
Using a custom parameter in a Publishing Template?
Hi,
How can I use a custom parameter in a publishing template?
I'm currently using this template to add check boxes to lcAnswerContent2 in a PDF.
Now I would like to create an alternate output showing the answers for the instructor.
- Switching between the two versions with a custom parameter seems to still be the best approach.
- I have a PDF2 plugin that does this and I would like to do the same with a publishing template.
A custom "instructor" parameter would allow me to have both versions in the same PT but I haven't found how to create and use a custom parameter yet. Can it be done?
Could you point me in the right direction?
Regards,
Raymond
How can I use a custom parameter in a publishing template?
I'm currently using this template to add check boxes to lcAnswerContent2 in a PDF.
Code: Select all
<extension id="com.oxygenxml.pdf.css.xsl.merged2html5" file="xslt/merged2html5Extension.xsl"/>
Code: Select all
<xsl:template match="*[contains(@class, ' topic/div ')][contains(@class, ' learning2-d/lcAnswerContent2 ')]">
<div>
<xsl:call-template name="commonattributes"/>
<xsl:call-template name="setid"/>
<span class="checkbox"> </span><span> </span>
<xsl:apply-templates/>
</div>
</xsl:template>
- Switching between the two versions with a custom parameter seems to still be the best approach.
- I have a PDF2 plugin that does this and I would like to do the same with a publishing template.
A custom "instructor" parameter would allow me to have both versions in the same PT but I haven't found how to create and use a custom parameter yet. Can it be done?
Could you point me in the right direction?
Regards,
Raymond
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Using a custom parameter in a Publishing Template?
Post by julien_lacour »
Hello Raymond,
You can add a custom parameter to the PDF - based on HTML5 & CSS transformation, but you need to create an additional DITA-OT plugin:
When these steps are finished, you can go back to your publishing engine and modify the XSLT style-sheet (the extension declaration is OK), for example:
Now, in Oxygen, go to Options > Preferences... > DITA, then select Custom and set the path to the unzipped folder from step 1. (make sure the path ends with 'oxygen-publishing-engine-3.x', the folder must contains the /bin, /plugins, etc. folders).
Finally to control your custom parameter, simply open the transformation dialog from the DITA Maps Manager, duplicate the DITA Map PDF - based on HTML5 & CSS transformation, select the Parameters tab, click New then create the 'instructor' parameter with value "true" of "false".
Regards,
Julien
You can add a custom parameter to the PDF - based on HTML5 & CSS transformation, but you need to create an additional DITA-OT plugin:
- Download and unzip Oxygen Publishing Engine (I recommend this method to avoid losing your plugin if you plan to upgrade Oxygen in the future)
- Add a folder in Oxygen Publishing Engine '/plugins' folder
- Create a DITA-OT plugin file in the newly created folder with a content similar to this one:
Code: Select all
<plugin id="REPLACE_WITH_DITA-OT_FOLDER_NAME"> <feature extension="com.oxygenxml.pdf.css.xsl.merged2html5.parameters" file="params.xml"/> </plugin>
- Create an XML file in the same folder as the plugin with the following content:
Code: Select all
<dummy> <param name="instructor" expression="${instructor}" if="instructor"/> </dummy>
- Open a command line in Oxygen Publishing Engine '/bin' folder and run the command
Code: Select all
dita install
When these steps are finished, you can go back to your publishing engine and modify the XSLT style-sheet (the extension declaration is OK), for example:
Code: Select all
<!-- Declare the parameter, the select is not mandatory (it's the default value in case the parameter isn't set). -->
<xsl:param name="instructor" select="'false'"/>
<xsl:template match="*[contains(@class, ' topic/div ')][contains(@class, ' learning2-d/lcAnswerContent2 ')]">
<div>
<xsl:call-template name="commonattributes"/>
<xsl:call-template name="setid"/>
<!-- Test the parameter value -->
<xsl:if test="$instructor = 'true'">
<span class="checkbox"> </span>
<span> </span>
</xsl:if>
<xsl:apply-templates/>
</div>
</xsl:template>
Finally to control your custom parameter, simply open the transformation dialog from the DITA Maps Manager, duplicate the DITA Map PDF - based on HTML5 & CSS transformation, select the Parameters tab, click New then create the 'instructor' parameter with value "true" of "false".
Regards,
Julien
-
- Posts: 31
- Joined: Sat Jan 17, 2015 6:21 pm
Re: Using a custom parameter in a Publishing Template?
Thank you! It works perfectly...
Now I just need to figure out the best way to add content to the cover page using this parameter.
I've read these pages but didn't find what I was looking for...
https://www.oxygenxml.com/doc/versions/ ... cover_page
https://www.oxygenxml.com/doc/versions/ ... yling.html
I could probably change a background image with a args.css.param... (duplicating the parameter)
But I'd like to reuse this instructor parameter to overlay some text on the cover page.
Should I override the template for <oxy:front-page> in "xslt/merged2html5Extension.xsl"
I think I'll have a look into this option tomorrow...
I just started using Publishing Templates and Chemistry to make PDF and I love it.
Thanks for making Oxygen such a great Editor and supporting us like you are!
Best regards,
Raymond
Now I just need to figure out the best way to add content to the cover page using this parameter.
I've read these pages but didn't find what I was looking for...
https://www.oxygenxml.com/doc/versions/ ... cover_page
https://www.oxygenxml.com/doc/versions/ ... yling.html
I could probably change a background image with a args.css.param... (duplicating the parameter)
But I'd like to reuse this instructor parameter to overlay some text on the cover page.
Should I override the template for <oxy:front-page> in "xslt/merged2html5Extension.xsl"
I think I'll have a look into this option tomorrow...
I just started using Publishing Templates and Chemistry to make PDF and I love it.
Thanks for making Oxygen such a great Editor and supporting us like you are!
Best regards,
Raymond
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Using a custom parameter in a Publishing Template?
Post by julien_lacour »
Hello,
You're welcome! And thank you for the kind words.
We recommend the usage of XSLT extensions in case you want to change the structure of your document.
If you just want to add content into the cover page you can take a look at this topic (especially the 'How to Show Metadata in the Cover Page' part). Maybe the usage of the CSS oxy_xpath() function is sufficient to bring information into the cover page.
Regards,
Julien
You're welcome! And thank you for the kind words.
We recommend the usage of XSLT extensions in case you want to change the structure of your document.
If you just want to add content into the cover page you can take a look at this topic (especially the 'How to Show Metadata in the Cover Page' part). Maybe the usage of the CSS oxy_xpath() function is sufficient to bring information into the cover page.
Regards,
Julien
-
- Posts: 31
- Joined: Sat Jan 17, 2015 6:21 pm
Re: Using a custom parameter in a Publishing Template?
Hi Julien,
I'll probably use a mix of args.css.param... and oxy_path(...).
You might want to fix this small error on the "dcpp_metadata" page.
I the section on "Processing Ditamap Metadata", the css rule reading the revision date misses the "oxy_path" before the first parenthesis.
Thanks again and have a great weekend.
Raymond
I'll probably use a mix of args.css.param... and oxy_path(...).
You might want to fix this small error on the "dcpp_metadata" page.
I the section on "Processing Ditamap Metadata", the css rule reading the revision date misses the "oxy_path" before the first parenthesis.
Thanks again and have a great weekend.
Raymond
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Using a custom parameter in a Publishing Template?
Post by julien_lacour »
Hi Raymond,
I will correct the small error on our user-guide, thank you for the report!
Have a great weekend too!
Julien
I will correct the small error on our user-guide, thank you for the report!
Have a great weekend too!
Julien
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)
- ↳ 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