Actions
Bug #2795
closedError message "Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation"
Start date:
2016-06-14
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
9.6, 9.7, trunk
Fix Committed on Branch:
9.6, 9.7, trunk
Description
When executing the below code I obtain this exception:
Exception in thread "main" java.lang.IllegalArgumentException: Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation
at net.sf.saxon.s9api.Serializer.setOutputProperty(Serializer.java:490)
at net.sf.saxon.jaxp.TransformerImpl.transform(TransformerImpl.java:142)
at com.oxygenxml.transformer.XSLOutputException.main(XSLOutputException.java:44)
Source xslSource = new StreamSource(new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n" +
" version=\"1.0\">\n" +
" \n" +
" <xsl:output cdata-section-elements=\"MASTER_COMMENTS\"/>\n" +
" \n" +
" <xsl:template match=\"@* | node()\">\n" +
" <xsl:copy>\n" +
" <xsl:apply-templates select=\"@* | node()\"/>\n" +
" </xsl:copy>\n" +
" </xsl:template>\n" +
"</xsl:stylesheet>"));
Transformer newTransformer = TransformerFactoryImpl.newInstance().newTransformer(xslSource);
String outputProperty = newTransformer.getOutputProperty("cdata-section-elements");
System.out.println("cdata-section-elements " + outputProperty);
Source xmlSource = new StreamSource(new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<MASTER_COMMENTS>\n" +
"</MASTER_COMMENTS>"));
StringWriter writer = new StringWriter();
Result outputTarget = new StreamResult(writer);
newTransformer.transform(xmlSource, outputTarget);
System.out.println(writer.toString());
The strange part is that the exception is triggered by the presence of this line of code:
String outputProperty = newTransformer.getOutputProperty("cdata-section-elements");
As far as I can tell, net.sf.saxon.lib.SaxonOutputKeys.parseListOfNodeNames(String, NamespaceResolver, boolean, boolean, String) builds clark notations like {}MASTER_COMMENTS
and a bit later SaxonOutputKeys.checkListOfClarkNames considers them invalid.
Please register to edit this issue
Actions