Output PDF file name based on variables
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 9
- Joined: Wed Jan 24, 2024 4:36 pm
Output PDF file name based on variables
Post by oxygen-user »
Hi,
How can I make sure the PDF output file name is based on the DITA bookmap title (or certain keywords)?
I tested various methods but none of them worked.
Best wishes.
How can I make sure the PDF output file name is based on the DITA bookmap title (or certain keywords)?
I tested various methods but none of them worked.
Best wishes.
Code: Select all
<!-- Overwrite file name, See
https://www.oxygenxml.com/doc/versions/26.1/ug-pdf-css/topics/dcpp_parameters.html?hl=args.output.base
https://www.oxygenxml.com/doc/versions/26.0/ug-editor/topics/editor-variables.html?hl=xpath_eval
https://www.oxygenxml.com/forum/post71459.html#p71459
https://www.oxygenxml.com/forum/post54730.html#p54730
-->
<!--with rootmapURL https://www.oxygenxml.com/doc/versions/26.1/ug-editor/topics/editor-variables.html -->
<!--Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(doc('${rootMapURL}')//*[contains (@class, " front-page/front-page-title")]/*[contains(@class, " topic/title ")]/*[contains(@class, " topic/keyword ")][2])}"/> -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(//*[contains (@class, " front-page/front-page-title")]/*[contains(@class, " topic/title ")]/*[contains(@class, " topic/keyword ")][2])}"/> -->
<!-- static -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(normalize-space(string-join(/*[contains(@class, 'topic/title')]//text())))}"/> -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(normalize-space(string-join(/*[contains(@class, 'map/map')]/*[contains(@class, 'front-page/front-page-title')]//text())))}"/> -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(normalize-space(string-join(/*[contains(@class, 'map/map')]/*[contains(@class, 'topic/title')]//text())))}"/> -->
<!-- file name is identical to value -->
<!--<parameter name="args.output.base" value="${xpath_eval(upper-case(substring('${cfn}', 1, 4)))}"/>-->
<!-- dynamic -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${ask('Set new ID attribute', generic, '${xpath_eval(normalize-space(string-join(/*[contains(@class, 'front-page/front-page-title')]//text())))}"/> -->
<!-- <parameter name="args.output.base" value="${ask('Set new ID attribute', generic, '${xpath_eval(//*[contains (@class, " front-page/front-page-title")]/*[contains(@class, " topic/title ")]/*[contains(@class, " topic/keyword ")][2]}')}"/> -->
<!-- file name is identical to value -->
<!-- <parameter name="args.output.base" value="${ask('Message', input_type, '${cfn}')}"/> -->
Re: Output PDF file name based on variables
I'd recommend to read the metadata from your map after preprocessing (after keyrefs are resolved) and then do the renaming in a new Ant target at the end of the processing.
stefan-jung.org – Your DITA/DITA-OT XML consultant
-
- Posts: 559
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Output PDF file name based on variables
Post by julien_lacour »
Hello,
You cannot use rootmapURL editor variable in args.output.base value, only the following ones:
If you still cannot make the transformation succeeds, could you copy the failure stacktrace here?
Regards,
Julien
You cannot use rootmapURL editor variable in args.output.base value, only the following ones:
- image.png (55.82 KiB) Viewed 747 times
Regards,
Julien
-
- Posts: 9
- Joined: Wed Jan 24, 2024 4:36 pm
Re: Output PDF file name based on variables
Post by oxygen-user »
Hi,
Sorry for not getting back to you earlier.
I just get quite a generic error message.
I tested the following parameters individually but all of them failed:
Do you know what else I could try?
Sorry for not getting back to you earlier.
I just get quite a generic error message.
Code: Select all
System ID: C:\Users\...\Desktop\....ditamap
Scenario: DITA Map PDF - based on HTML5 & CSS (...)
Input file: C:\Users\...\Desktop\....ditamap
Engine name: DITA-OT
Severity: fatal
Description: Transformation failed.
I tested the following parameters individually but all of them failed:
Code: Select all
<!-- Overwrite file name, See
https://www.oxygenxml.com/doc/versions/26.1/ug-pdf-css/topics/dcpp_parameters.html?hl=args.output.base
https://www.oxygenxml.com/doc/versions/26.0/ug-editor/topics/editor-variables.html?hl=xpath_eval
https://www.oxygenxml.com/forum/post71459.html#p71459
https://www.oxygenxml.com/forum/post54730.html#p54730
-->
<!--with rootmapURL https://www.oxygenxml.com/doc/versions/26.1/ug-editor/topics/editor-variables.html -->
<!--Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(doc('${rootMapURL}')//*[contains (@class, " front-page/front-page-title")]/*[contains(@class, " topic/title ")]/*[contains(@class, " topic/keyword ")][2])}"/> -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(//*[contains (@class, " front-page/front-page-title")]/*[contains(@class, " topic/title ")]/*[contains(@class, " topic/keyword ")][2])}"/> -->
<!--<parameter name="args.output.base" value="${xpath_eval(//*[contains(@class, 'topic/category')])}"/>-->
<!-- static -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(normalize-space(string-join(/*[contains(@class, 'topic/title')]//text())))}"/> -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(normalize-space(string-join(/*[contains(@class, 'map/map')]/*[contains(@class, 'front-page/front-page-title')]//text())))}"/> -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${xpath_eval(normalize-space(string-join(/*[contains(@class, 'map/map')]/*[contains(@class, 'topic/title')]//text())))}"/> -->
<!-- file name is identical to value -->
<!--<parameter name="args.output.base" value="${xpath_eval(upper-case(substring('${cfn}', 1, 4)))}"/>-->
<!-- <parameter name="args.output.base" value="${xpath_eval(normalize-space(string-join(//*[contains(@class, "front-page/front-page")]/*[contains(@class, "map/topicmeta")]/*[contains(@class, "topic/category")]/*[contains(@class, "topic/keyword")]/text())))}"/> -->
<!-- dynamic -->
<!-- Transformation fails -->
<!-- <parameter name="args.output.base" value="${ask('Set new ID attribute', generic, '${xpath_eval(normalize-space(string-join(/*[contains(@class, 'front-page/front-page-title')]//text())))}"/> -->
<!-- <parameter name="args.output.base" value="${ask('Set new ID attribute', generic, '${xpath_eval(//*[contains (@class, " front-page/front-page-title")]/*[contains(@class, " topic/title ")]/*[contains(@class, " topic/keyword ")][2]}')}"/> -->
<!-- file name is identical to value -->
<!-- <parameter name="args.output.base" value="${ask('Message', input_type, '${cfn}')}"/> -->
-
- Posts: 559
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Output PDF file name based on variables
Post by julien_lacour »
Hello,
I forget to mention that you can't use editor variables when you set the args.output.base parameter outside of Oxygen so ${xpath_eval(expression)} will not expand in command line or inside a publishing template descriptor (in <parameter/>).
Sorry for the misleading.
Regards,
Julien
I forget to mention that you can't use editor variables when you set the args.output.base parameter outside of Oxygen so ${xpath_eval(expression)} will not expand in command line or inside a publishing template descriptor (in <parameter/>).
Sorry for the misleading.
Regards,
Julien
-
- Posts: 915
- Joined: Thu May 02, 2019 2:32 pm
Re: Output PDF file name based on variables
Post by chrispitude »
Hi oxygen-user,
We have a similar situation. Our PDFs are named as follows:
If you are interested, I could write an Oxygen XML blog post that explains how to do it.
We have a similar situation. Our PDFs are named as follows:
- For maps that are published in a single configuration, we want the PDF to be named using the map.
- For maps that are published in multiple configurations via DITAVAL, we want the PDF to be named using the keyscope.
- A single WebHelp deliverable is created for the entire OLH ditamap
- A PDF deliverable is created for each bookmap reference in the OLH ditamap, with the args.output.base parameter determined using the rules above
If you are interested, I could write an Oxygen XML blog post that explains how to do it.
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