Insert/Preserve XSL Attribute Values in PDF Output
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 171
- Joined: Thu Aug 30, 2018 10:06 pm
Insert/Preserve XSL Attribute Values in PDF Output
Post by dreifsnider »
Hello!
I'm trying to find some way to insert/preserve the xsl attribute names and their values that are applied to fo objects in the final PDF deliverable. I'm looking to create a stylesheet of all the attribute sets that are used and applied to all nodes for my custom PDF plugin.
Ideally, I would like something along the lines of:
for all fo objects (fo:inline, fo:block, fo:table, etc.)
I've tried creating a template that matches every node and inserts the local-name of the node:
but this isn't giving me the desired result, because this just returns the node name and not the attributes that are applied. I'm wondering if I need to add a post-processing step that would comb through the topic.fo?
Any help on this would be greatly appreciated.
Thanks!
-Daniel
I'm trying to find some way to insert/preserve the xsl attribute names and their values that are applied to fo objects in the final PDF deliverable. I'm looking to create a stylesheet of all the attribute sets that are used and applied to all nodes for my custom PDF plugin.
Ideally, I would like something along the lines of:
Code: Select all
<fo:block attribute1="value" attribute2="value">Some text attribute 1:value attribute2:value</fo:block>
I've tried creating a template that matches every node and inserts the local-name of the node:
Code: Select all
<xsl:template match="*">
<xsl:for-each select=".">
<xsl:value-of select="local-name()"/>
<xsl:apply-templates/>
</xsl:for-each>
</xsl:template>
Any help on this would be greatly appreciated.
Thanks!
-Daniel
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Insert/Preserve XSL Attribute Values in PDF Output
Hi Daniel,
I'm not sure how you could do this, indeed probably as another post processing step on the XSL-FO output (setting the "clean.temp" parameter to "no" so that the XSL-FO file remains in the transformation temporary folder).
And in order to iterate an element's attributes you need to probably do it like this:
Regards,
Radu
I'm not sure how you could do this, indeed probably as another post processing step on the XSL-FO output (setting the "clean.temp" parameter to "no" so that the XSL-FO file remains in the transformation temporary folder).
And in order to iterate an element's attributes you need to probably do it like this:
Code: Select all
<xsl:template match="*">
<xsl:for-each select="@*">
<xsl:value-of select="local-name()"/>
<xsl:apply-templates/>
</xsl:for-each>
</xsl:template>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 171
- Joined: Thu Aug 30, 2018 10:06 pm
Re: Insert/Preserve XSL Attribute Values in PDF Output
Post by dreifsnider »
Hi Radu,
Thanks for your reply and code example! I'll try working on something and see what I come up with.
In the interim, do you know of any other way that I could obtain all the styling used for a PDF plugin other than manually combing through all the templates and the attribute sets they call?
Cheers,
-Daniel
Thanks for your reply and code example! I'll try working on something and see what I come up with.
In the interim, do you know of any other way that I could obtain all the styling used for a PDF plugin other than manually combing through all the templates and the attribute sets they call?
Cheers,
-Daniel
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Insert/Preserve XSL Attribute Values in PDF Output
Hi Daniel,
Other than looking at the final XSL-FO file to see how certain XML elements have been mapped to XSL-FO elements I'm not sure how this could be handled. Maybe you can try to register and ask around on the DITA Users List.
Honestly our main improvement direction when it comes to creating PDF from DITA is focus towards using CSS to style the DITA content and obtain the PDF. CSS-based styling is way easier to debug, you can even do that with a web browser or with Oxygen's own CSS Inspector view. And it's also way easier to write and maintain.
Regards,
Radu
Other than looking at the final XSL-FO file to see how certain XML elements have been mapped to XSL-FO elements I'm not sure how this could be handled. Maybe you can try to register and ask around on the DITA Users List.
Honestly our main improvement direction when it comes to creating PDF from DITA is focus towards using CSS to style the DITA content and obtain the PDF. CSS-based styling is way easier to debug, you can even do that with a web browser or with Oxygen's own CSS Inspector view. And it's also way easier to write and maintain.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 171
- Joined: Thu Aug 30, 2018 10:06 pm
Re: Insert/Preserve XSL Attribute Values in PDF Output
Post by dreifsnider »
Thanks for the reply Radu.
I'm actually starting to look into using the CSS Paged Media and PDF Chemistry, because I'm getting a little tired of XSL-FO.
Thanks again for your help with this.
Cheers!
Daniel
I'm actually starting to look into using the CSS Paged Media and PDF Chemistry, because I'm getting a little tired of XSL-FO.

Thanks again for your help with this.
Cheers!
Daniel
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