XSL: apply fontdef to <keyword> element except when <keyword> is nested in <title>
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 42
- Joined: Wed Jun 20, 2018 11:30 am
XSL: apply fontdef to <keyword> element except when <keyword> is nested in <title>
Post by pieterjan_vdw »
Hi,
I would like to achieve the following:
have italics fontdef to all <keyword outputclass="column"> elements in my PDF file (Miramo),
except when <keyword outputclass="column"> is nested in the title
Example:
this is my xslt
Anyone who can help me with the part
Thank you
I would like to achieve the following:
have italics fontdef to all <keyword outputclass="column"> elements in my PDF file (Miramo),
except when <keyword outputclass="column"> is nested in the title
Example:
Code: Select all
<concept id="aa1258889" xml:lang="en-us">
<title>This is my title (<keyword outputclass="column">No Italics keyword</keyword>) </title>
<conbody>
<p><keyword outputclass="column">Italics keyword</keyword></p>
</conbody>
</concept>
Code: Select all
<xsl:template match="*[contains(@class,' topic/keyword ')]">
<xsl:choose>
<xsl:when test="@outputclass='column'[not(self::title/keyword[@outputclass='column'])]">
<Font fontDef="italic">
<xsl:apply-templates/>
</Font>
</xsl:when>
<xsl:otherwise>
<xsl:apply-imports/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Code: Select all
<xsl:when test...>
Thank you
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: XSL: apply fontdef to <keyword> element except when <keyword> is nested in <title>
Hi,
I think the template match should look something like:
About a year or two ago we added a new way to obtain PDF from DITA using CSS to style the output:
https://www.oxygenxml.com/doc/versions/ ... 5-x-2.html
and of course with CSS doing something like this is a snap:
Regards,
Radu
I think the template match should look something like:
Code: Select all
<xsl:template match="*[contains(@class,' topic/keyword ')][not(ancestor::*[contains(@outputclass, ' topic/title ')])]">
https://www.oxygenxml.com/doc/versions/ ... 5-x-2.html
and of course with CSS doing something like this is a snap:
Code: Select all
keyword {
font-family: "Arial";
}
title keyword {
font-family: inherit;
}
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 42
- Joined: Wed Jun 20, 2018 11:30 am
Re: XSL: apply fontdef to <keyword> element except when <keyword> is nested in <title>
Post by pieterjan_vdw »
Thanks Radu, also for the CSS suggestion. I'll give it a try.
I had to make a small change to the XSL suggestion. I add it for future reference.
instead of
I had to make a small change to the XSL suggestion. I add it for future reference.
Code: Select all
[not(ancestor::*[contains(@class, ' topic/title ')])]">
Code: Select all
[not(ancestor::*[contains(@outputclass, ' topic/title ')])]">
Code: Select all
<xsl:template match="*[contains(@class,' topic/keyword ')][not(ancestor::*[contains(@class, ' topic/title ')])]">
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