I've been able to reproduce my "xml declaration in attributes" problem by forcing what I believe to be happening when there is a classloader issue.
in org/apache/xalan/transformer/TransformerImpl.java:
private OutputProperties m_textformat = new OutputProperties(Method.Text);
But if the OutputProperties class can't find the output_text.properties resource, it will return the default - which is the xml properties.
Later, in TransformerImpl.transformToString(), m_textformat is used when getting a Serializer. transformToString is called elsewhere (such as org/apache/xalan/templates/ElemAttribute.java), so I think this can lead to the xml declaration problem.
Using the following diff, I can consistently get output such as:
<a href="<?xml version=%221.0%22 encoding=%22UTF-8%22?>%0A">
diff -C2 xalan-j_2_4_1/src/org/apache/xalan/templates/OutputProperties.java xalan-j_2_4_1-patched/src/org/apache/xalan/templates/OutputProperties.java
*** xalan-j_2_4_1/src/org/apache/xalan/templates/OutputProperties.java Thu Oct 31 14:26:10 2002
--- xalan-j_2_4_1-patched/src/org/apache/xalan/templates/OutputProperties.java Tue Nov 26 12:43:41 2002
***************
*** 349,353 ****
if (null == m_text_properties) // double check
{
! fileName = "output_text.properties";
m_text_properties = loadPropertiesFile(fileName,
m_xml_properties);
--- 349,353 ----
if (null == m_text_properties) // double check
{
! fileName = "output_xml.properties";
m_text_properties = loadPropertiesFile(fileName,
m_xml_properties);
So I think that my tentative conclusions are: -xalan can indeed produce this output -I should look into fixing classloading in my environment.. :-)
Alex
