title: xsl cdata-section-elements output property with Xalan-J
body: <p>I'm trying to output a CDATA section in the result of XSLT using Xalan 2.7.1.  I have applied this XSL to the XML in a tool and the result contains CDATA.  In the method below, no CDATA is in the result and no exception is thrown.  I feel like I'm missing something here.</p>
  
  <p><strong>test.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;parentelem&gt;
      &lt;childelem&gt;Test text&lt;/childelem&gt;
  &lt;/parentelem&gt;
  </code></pre>
  
  <p><strong>test.xsl</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:output method="xml" encoding="UTF-8" cdata-section-elements="newchildelem" /&gt;
  &lt;xsl:template match="/"&gt;
  &lt;parentelem&gt;
      &lt;newchildelem&gt;&lt;xsl:value-of select="/parentelem/childelem" /&gt;&lt;/newchildelem&gt;
  &lt;/parentelem&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p><strong>Transform.java</strong></p>
  
  <pre><code>import java.io.FileReader;
  import java.io.StringWriter;
  
  import javax.xml.stream.XMLInputFactory;
  import javax.xml.stream.XMLOutputFactory;
  import javax.xml.stream.XMLStreamReader;
  import javax.xml.stream.XMLStreamWriter;
  import javax.xml.transform.Result;
  import javax.xml.transform.Source;
  import javax.xml.transform.Transformer;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.stax.StAXResult;
  import javax.xml.transform.stax.StAXSource;
  
  public class Transform {
  
      public static void main (String[] args){
      try {
          XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(
              new FileReader("test.xml"));
  
          XMLStreamReader xslReader = XMLInputFactory.newInstance().createXMLStreamReader(
                  new FileReader("test.xsl"));
  
          TransformerFactory transformerFactory = TransformerFactory.newInstance();
          Source xslSource = new StAXSource(xslReader);
          Source xmlSource = new StAXSource(xmlReader);
          Transformer transf = transformerFactory.newTransformer(xslSource);
  
          StringWriter xmlString = new StringWriter();
          XMLStreamWriter xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(
                  xmlString);
  
          Result transformedXml = new StAXResult(xmlWriter);
          transf.transform(xmlSource, transformedXml);
  
          xmlWriter.flush();
          System.out.println(xmlString.toString());
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  }
  </code></pre>
  
  <p><strong>console output</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;parentelem&gt;&lt;newchildelem&gt;Test text&lt;/newchildelem&gt;&lt;/parentelem&gt;
  </code></pre>