Can I use a character map for >
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 313
- Joined: Wed Jun 17, 2015 10:19 am
Can I use a character map for >
Post by ann.jensen »
Hi,
My XSLT transform based on DITA-OT 1.7.5 (not written by me) takes source XML like
and outputs
The output for the XSLT is set to XML and the main templates are
Instead I want output with < and >
Should I be able to use a character map to do this conversion e.g.
Any advice appreciated,
Regards,
Ann
My XSLT transform based on DITA-OT 1.7.5 (not written by me) takes source XML like
Code: Select all
<sectiondiv outputclass="string_text">
<iframe
src="https://player.vimeo.com/video/785670628"
style="max-width:437px" width="100%" height="246" frameborder="0" allow="autoplay;
fullscreen; picture-in-picture" allowfullscreen></iframe>
</sectiondiv>
Code: Select all
<text><![CDATA[
<iframe
src="https://player.vimeo.com/video/785670628"
style="max-width:437px" width="100%" height="246" frameborder="0" allow="autoplay;
fullscreen; picture-in-picture" allowfullscreen></iframe>
]]></text>
Code: Select all
<xsl:template match="//sectiondiv[@outputclass='string_text']" mode="XML">
<text>
<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
<xsl:apply-templates />
<xsl:text disable-output-escaping="yes">]]></xsl:text>
</text>
</xsl:template>
<xsl:template match="*" mode="XML">
<xsl:copy copy-namespaces="no">
<xsl:copy-of select="@*[name(.)!='class']" copy-namespaces="no"/>
<xsl:apply-templates mode="XML"/>
</xsl:copy>
</xsl:template>
Code: Select all
<text><![CDATA[
<iframe
src="https://player.vimeo.com/video/785670628"
style="max-width:437px" width="100%" height="246" frameborder="0" allow="autoplay;
fullscreen; picture-in-picture" allowfullscreen></iframe>
]]></text>
Code: Select all
<xsl:character-map name="cm">
<xsl:output-character character="<" string="<"/>
<xsl:output-character character=">" string=">"/>
</xsl:character-map>
<xsl:output method="xml" version="1.1" indent="yes" cdata-section-elements=" required-cleanup " use-character-maps="cm"/>
Regards,
Ann
-
- Posts: 101
- Joined: Tue Aug 19, 2014 12:04 pm
Re: Can I use a character map for >
Post by Martin Honnen »
Instead of using apply-templates, I would suggest to use the serialize function e.g.
Code: Select all
<xsl:value-of select="serialize(node(), map { 'method' : 'xml' })"/>
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