How to generate bold and italic text using XSLT
Here should go questions about transforming XML with XSLT and FOP.
How to generate bold and italic text using XSLT
Hi,
I am having some problems generating bold and italic text. I have tried a few different methods, and found quite a few suggestions on the Net, but nothing seems to work. A sample of my XML for me at the moment is like this:
This unfortunately has a major flaw as the XSL I am using makes the whole paragraph bold even if there are only a couple of words that are within the bold tags. I know there is a way to do this by having <text></text><b></b><text></text> and so on but this is a ridiculous amount of extra work. Does anyone know how I can get this to work better? The current XSL I am using is:
I am having some problems generating bold and italic text. I have tried a few different methods, and found quite a few suggestions on the Net, but nothing seems to work. A sample of my XML for me at the moment is like this:
Code: Select all
<para><emphasis role="bold">Taxi:</emphasis> Good news! Montevideo’s taxi drivers are, in our opinion, honest and invariably helpful. Taxis are hailed in the street or picked up at a taxi rank. They use a meter that clocks up a number of units (fichas) which have to be converted into the fare you pay by consulting a <emphasis role="italic">fare chart</emphasis>, which is displayed in the back of each cab.</para>
Code: Select all
<xsl:template match="para">
<p>
<xsl:choose>
<xsl:when test='emphasis[@role="bold"]'>
<xsl:element name="strong">
<xsl:value-of select="."/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</p>
</xsl:template>
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