Custom transformation parameters for css (background image for the title page)
Post here questions and problems related to editing and publishing DITA content.
Custom transformation parameters for css (background image for the title page)
Hello, I need some help again.
I use the XSLT and CSS to PDF Transformation Scenario and have specified a background image for the title page
It works fine as long as we need the same title page all the time. But to produce different documents with different titlepages I would like to pass the url to an image as parameter to the transformation.
I tried to make a new parameter "titlepage" in the transformation settings and refer to it with
But this does not work.
How can we pass the filename to transformation?
tia
Jörn
I use the XSLT and CSS to PDF Transformation Scenario and have specified a background image for the title page
Code: Select all
@page front-page{
background-image: url("../img/title.png");
}
I tried to make a new parameter "titlepage" in the transformation settings and refer to it with
Code: Select all
@page front-page{
background-image: url(${titlepage});
}
How can we pass the filename to transformation?
tia
Jörn
-
- Posts: 581
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Custom transformation parameters for css
Post by julien_lacour »
Hello,
The best thing to do is to use a custom parameter:
Regards,
Julien
The best thing to do is to use a custom parameter:
- In the transformation scenario dialog, create a new parameter called for example "args.css.param.cover-page" and set its value to the image path (for example: "../img/title.png")
- In your CSS file use the following selector
Code: Select all
@page front-page { background-image: url(oxy_xpath('/*/@*[local-name()="cover-page"][1]')); }
Regards,
Julien
Re: Custom transformation parameters for css
Please note that the image path should be given as an absolute URI, like: file:/C:/temp/example.svg. It works also with relative paths, but it will solve them relative to the XML location.
-
- Posts: 918
- Joined: Thu May 02, 2019 2:32 pm
Re: Custom transformation parameters for css
Post by chrispitude »
Useful technique, thank you!
Is there a way to write a CSS selector so that it is only applied when the parameter is set to a particular value?
Is there a way to write a CSS selector so that it is only applied when the parameter is set to a particular value?
-
- Posts: 581
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Custom transformation parameters for css
Post by julien_lacour »
Hello,
It is possible to control the first parameter by using a second custom parameter, for example "args.css.param.use-cover" with value "yes".
Then in the CSS, using the following selectors:
Regards,
Julien
It is possible to control the first parameter by using a second custom parameter, for example "args.css.param.use-cover" with value "yes".
Then in the CSS, using the following selectors:
Code: Select all
:root[use-cover='yes'] *[class~='front-page/front-page'] {
page: custom-front-page;
}
@page custom-front-page {
background-image: url(oxy_xpath('/*/@*[local-name()="cover-page"][1]'));
}
Julien
Re: Custom transformation parameters for css
This works well, thank you!
Sometimes it is hard to figure out these cryptic notations
We have to use the relative paths because the XML data is in a repository and will be downloaded to different locations.
Regards
Joern
Sometimes it is hard to figure out these cryptic notations
We have to use the relative paths because the XML data is in a repository and will be downloaded to different locations.
Regards
Joern
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