Can I use a character map for >
Posted: Tue Dec 12, 2023 4:39 pm
				
				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