DITA map PDF – based on HTML5 &CSS transformation with xslt extension points
Post here questions and problems related to editing and publishing DITA content.
DITA map PDF – based on HTML5 &CSS transformation with xslt extension points
Dear all,
I am building templates for a datasheet written in DITA. I am using the Oxygen DITA map PDF – based on HTML5 &CSS transformation. This really works great I have to say, it is the first time I can almost get everything I want to get working in the layout work for DITA!
However now I encounter a problem for which I need an xslt extension point. And then my knowledge get limited.
What I want is the following. Now my datasheet.merged.html contains the following code:
And I want:
Looking at examples I made the following extension xslt:
In the opt file I have the following:
This partially does the Job, with the following problems:
1. match="*[contains(@class, ' topic/title ')]" makes that this change is applied to all topic titles. I only want it to be applied to the topic/title in the “front-page/front-page-title front-page-title” div. I tried using the front-page/front-page-title front-page-title in the match, but that did not change the output in any way. How can I get this working?
2. I don’t understand why this change does not work if in the opt file I use the id “com.oxygenxml.pdf.css.xsl.merged2html5”. Could somebody explain that? I read the user manual and I know there are two phases to apply changes but I thought this change had to be applied after the conversion to HTML while now it only seems to work before that conversion.
3. In my pdf I get the following text: [/map/concept/div {"doctype"}) datasheet (div], marked yellow, where does that come from?
Maybe anybody of you can give me new ideas where to search and what to try next.
Thanks,
Benny
I am building templates for a datasheet written in DITA. I am using the Oxygen DITA map PDF – based on HTML5 &CSS transformation. This really works great I have to say, it is the first time I can almost get everything I want to get working in the layout work for DITA!
However now I encounter a problem for which I need an xslt extension point. And then my knowledge get limited.
What I want is the following. Now my datasheet.merged.html contains the following code:
Code: Select all
<div class=" front-page/front-page-title front-page-title">
<div class="- topic/title title">product name</div>
</div>
Code: Select all
<div class=" front-page/front-page-title front-page-title">
<div class="doctype">datasheet</div>
<div class="- topic/title title">product name</div>
</div>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:oxyf="http://www.oxygenxml.com/functions"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="*[contains(@class, ' topic/title ')]">
<div class="doctype">Datasheet</div>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<xslt>
<extension id="com.oxygenxml.pdf.css.xsl.merged2merged" file="xslt/document-type.xsl"/>
</xslt>
1. match="*[contains(@class, ' topic/title ')]" makes that this change is applied to all topic titles. I only want it to be applied to the topic/title in the “front-page/front-page-title front-page-title” div. I tried using the front-page/front-page-title front-page-title in the match, but that did not change the output in any way. How can I get this working?
2. I don’t understand why this change does not work if in the opt file I use the id “com.oxygenxml.pdf.css.xsl.merged2html5”. Could somebody explain that? I read the user manual and I know there are two phases to apply changes but I thought this change had to be applied after the conversion to HTML while now it only seems to work before that conversion.
3. In my pdf I get the following text: [/map/concept/div {"doctype"}) datasheet (div], marked yellow, where does that come from?
Maybe anybody of you can give me new ideas where to search and what to try next.
Thanks,
Benny
Re: DITA map PDF – based on HTML5 &CSS transformation with xslt extension points
The extension should be bound to the last transformation, the merge2html5. it is currenlty bound to merged2merged in your publishing template, so please correct to:
In this way the XSLT template will apply on the HTML merged map, and you should be able to match and generate HTML elements.
You can use:
Many regards,
Dan
Code: Select all
<xslt>
<extension id="com.oxygenxml.pdf.css.xsl.merged2html5" file="xslt/document-type.xsl"/>
</xslt>
You can use:
Code: Select all
<xsl:template match="*[contains(@class, ' front-page/front-page-title ')]">
<div class="doctype">Datasheet</div>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
Dan
Re: DITA map PDF – based on HTML5 &CSS transformation with xslt extension points
Dear Dan,
Thanks for your reply.
However I tried this before and now double checked, but when I do what you say nothing is changed in the document.
I get the same output as if the xslt extension was not there.
That's also the reason why I asked question 2 because also for me it would have been more logical that the merged2html5 id should be used.
Thanks for your reply.
However I tried this before and now double checked, but when I do what you say nothing is changed in the document.
I get the same output as if the xslt extension was not there.
That's also the reason why I asked question 2 because also for me it would have been more logical that the merged2html5 id should be used.
Re: DITA map PDF – based on HTML5 &CSS transformation with xslt extension points
Let the XSL extend the merged2html5 extesion point.
Try adding a mode="#all" on the template.
Please let us know if it worked for you.
Many regards,
Dan
Try adding a mode="#all" on the template.
Code: Select all
<xsl:template match="*[contains(@class, ' front-page/front-page-title ')]" mode="#all">
<div class="doctype">Datasheet</div>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
Many regards,
Dan
Re: DITA map PDF – based on HTML5 &CSS transformation with xslt extension points
Dear Dan,
Thanks, adding the mode="all" seems to at least do something. However it also seems to do some other unwanted stuff. The result in the merged.html looks like below. i.e. the original div element seems to be replaced by the oxy:front-page-title element.
Maybe something in the <xsl:copy> part should be changed? Probably writing out the original code would also do the Job. Any clue what could go wrong here? else I will try the writing out the original part.
Thanks, adding the mode="all" seems to at least do something. However it also seems to do some other unwanted stuff. The result in the merged.html looks like below. i.e. the original div element seems to be replaced by the oxy:front-page-title element.
Maybe something in the <xsl:copy> part should be changed? Probably writing out the original code would also do the Job. Any clue what could go wrong here? else I will try the writing out the original part.
Code: Select all
<div xmlns:oxyf="http://www.oxygenxml.com/functions" class="doctype">Datasheet</div>
<oxy:front-page-title xmlns:oxy="http://www.oxygenxml.com/extensions/author"
xmlns:opentopic-index="http://www.idiominc.com/opentopic/index"
class=" front-page/front-page-title ">
<span style="background-color: yellow;">
<span style="font-weight: bold"> [/map/oxy:front-page/oxy:front-page-title/title {"- topic/title "}) </span>
TMX50-40x/CXP
<span style="font-weight: bold"> (title]</span>
</span>
</oxy:front-page-title>
Re: DITA map PDF – based on HTML5 &CSS transformation with xslt extension points
Yes, the "copy" element will simply copy the oxy: element from the merged map to the HTML output.
You should replace it by a div or other element:
You should replace it by a div or other element:
Code: Select all
<xsl:template match="*[contains(@class, ' front-page/front-page-title ')]" mode="#all">
<div class="doctype">Datasheet</div>
<div>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</div>
</xsl:template>
Re: DITA map PDF – based on HTML5 &CSS transformation with xslt extension points
Dear Dan,
The above code provides below result, still not what I am looking for unfortunately.
I did some more testing and up to now only this works, but I think it should be possible to make it more general without copying the code from the original output.
Something that came close in how it looked in the pdf was:
But the resulting code in the merged file looks ugly:
What are all the xmlns? Is there actually something like a "identity transformation"? Like described here: https://stackoverflow.com/questions/568 ... -with-xslt
If I try the code suggested here the code in the merged file is still looking different.
The above code provides below result, still not what I am looking for unfortunately.
Code: Select all
<div class=" front-page/front-page front-page">
<div xmlns:oxyf="http://www.oxygenxml.com/functions" class="doctype">Datasheet</div>
<div xmlns:oxyf="http://www.oxygenxml.com/functions" class=" front-page/front-page-title ">
<span style="background-color: yellow;">
<span style="font-weight: bold">
[/map/oxy:front-page/oxy:front-page-title/title {"- topic/title "})
</span>
Product name
<span style="font-weight: bold"> (title]</span>
</span>
</div>
</div>
Code: Select all
<xsl:template match="*[contains(@class, ' front-page/front-page-title ')]" mode="#all">
<div class=" front-page/front-page front-page">
<div class=" front-page/front-page-title front-page-title">
<div class="doctype">Datasheet</div>
<div class="- topic/title title">
<xsl:value-of select="."/>
</div>
</div>
</div>
</xsl:template>
Code: Select all
<xsl:template match="*[contains(@class, ' front-page/front-page-title ')]" mode="#all">
<div class="doctype">Datasheet</div>
<xsl:copy-of select="."/>
</xsl:template>
Code: Select all
<div class=" front-page/front-page front-page">
<div xmlns:oxyf="http://www.oxygenxml.com/functions" class="doctype">Datasheet</div>
<oxy:front-page-title xmlns:oxy="http://www.oxygenxml.com/extensions/author"
xmlns:opentopic-index="http://www.idiominc.com/opentopic/index" class=" front-page/front-page-title ">
<title xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
xmlns:opentopic="http://www.idiominc.com/opentopic"
xmlns:ot-placeholder="http://suite-sol.com/namespaces/ot-placeholder" class="- topic/title ">
Product name
</title>
</oxy:front-page-title>
</div>
If I try the code suggested here the code in the merged file is still looking different.
Re: DITA map PDF – based on HTML5 &CSS transformation with xslt extension points
My mistake, please add a mode="#current" on the apply-templates:
You should obtain in the merged HTML file:
If you still have problems, please write on our support email address, so I can send you a zip with a complete example.
Many regards,
Dan
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="*[contains(@class, ' front-page/front-page-title ')]" mode="#all">
<div class="doctype">Datasheet </div>
<div>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="#current"/>
</div>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<div class=" front-page/front-page front-page">
<div class="doctype">Datasheet</div>
<div class=" front-page/front-page-title ">
<div class="- topic/title bookmap/booktitle title booktitle">
<div class="- topic/ph bookmap/mainbooktitle ph mainbooktitle">Test
map</div>
</div>
</div>
</div>
Many regards,
Dan
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