You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2005/06/01 20:53:56 UTC
[jira] Commented: (XALANJ-2133) XSLTC identity transform doesn't set all JAXP output properties
[ http://issues.apache.org/jira/browse/XALANJ-2133?page=comments#action_66763 ]
Brian Minchau commented on XALANJ-2133:
---------------------------------------
A testcase to show that the Xalan specific indent-amount property
doesn't make it to the serializer, and that cdata-section-elements that have a URI in curly braces have problems too.
(One can easily switch the code below to Xalan-J interpretive to see
the difference)
static void case1() throws TransformerException, IOException {
final javax.xml.transform.TransformerFactory tFactory;
tFactory = new org.apache.xalan.xsltc.trax.TransformerFactoryImpl();
//tFactory = new org.apache.xalan.processor.TransformerFactoryImpl();
final javax.xml.transform.Transformer transformer;
transformer = tFactory.newTransformer();
transformer.setOutputProperty("method","xml");
transformer.setOutputProperty("indent","yes");
transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount","4");
transformer.setOutputProperty("cdata-section-elements","{uri1}b1");
String val = transformer.getOutputProperty("cdata-section-elements");
transformer.setOutputProperty("cdata-section-elements",val +' '+ "b2");
StringWriter sw = new StringWriter();
StringReader sr = new StringReader(
"<?xml version='1.0' ?>\n" +
"<doc xmlns:prfx1='uri1'>\n" +
"<a><prfx1:b1>some text in b1</prfx1:b1></a>\n" +
"<b2>some text in b2</b2>\n" +
"</doc>\n");
StreamResult strmrslt = new StreamResult(sw);
StreamSource strmsrc = new StreamSource(sr);
transformer.transform(strmsrc, strmrslt);
sw.flush();
String out = sw.toString();
sw.close();
System.out.println("=================================");
System.out.println(out);
System.out.println("=================================");
}
> XSLTC identity transform doesn't set all JAXP output properties
> ---------------------------------------------------------------
>
> Key: XALANJ-2133
> URL: http://issues.apache.org/jira/browse/XALANJ-2133
> Project: XalanJ2
> Type: Bug
> Reporter: Brian Minchau
> Attachments: patch.jira.2133.txt
>
> When running the XSLTC identity transform via JAXP it is possible to effectively set xsl:output properties via the JAXP setOutputProperty() method.
> Unfortunately the method
> transferOutputProperties(SerializationHandler)
> in the class:
> org.apache.xalan.xsltc.trax.TransformerImpl
> parses the output properties itself, and only passes those that it recognizes
> to the handler. In doing so it fails to pass any xalan extension properties, such as "{http://xml.apache.org/xalan}indent-amount". It also does its own parsing of "cdata-section-elements" and incorrectly parses the URI. It doesn't look for a URI surrounded by braces, as it should according to JAXP.
> All this method does is parse the properties and call setter-s one at a time on the handler. The fix is simply to pass the java.util.Properties object to the already public API that is on the Serializer interface, namely
> setOutputFormat(java.util.Properties)
> and let it deal with all of the properties itself. This will smoothly get all properties set via JAXP to the serializer.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org