Hi,

We're having trouble with xml:space="preserve" attributes being set
twice during SVG document transformation.  When an SVG doc containing
a <style> tag with xml:space="preserve" is passed in, it seems to
print this attribute twice in the output.  I've attached a small
program and a simple SVG doc that demonstrates the problem.

This seems to have been mentioned a few times here in the past:

http://koala.ilog.fr/batik/mlists/batik-users/archives/msg02575.html
http://koala.ilog.fr/batik/mlists/batik-users/archives/msg02595.html
http://koala.ilog.fr/batik/mlists/batik-users/archives/msg02680.html

Is this a Batik problem, a Xerces problem, or something else?  We're
using the latest code from CVS, and JDK 1.4.2.

Thanks.

--
George Armhold
Rutgers University
eLearning Grant, DCIS
import java.io.*;

import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;

import org.apache.batik.dom.svg.*;
import org.apache.batik.util.*;

import org.w3c.dom.*;
import org.w3c.dom.svg.*;

/**
 * Demonstrate problem in Transformer- attribute "xml:space" gets
 * repeated in <style> tag during transformation.
 *
 */
public class TransformerTest {

  public static void main(final String[] args) throws Exception {
    if (args.length != 2) {
      System.err.println("Usage: java TransformerTest in.svg out.svg");
      System.exit(1);
    }

    File infile = new File(args[0]);
    File outfile = new File(args[1]);

    String parser = XMLResourceDescriptor.getXMLParserClassName();
    SAXSVGDocumentFactory svgFactory = new SAXSVGDocumentFactory(parser);
    SVGDocument doc = (SVGDocument) 
svgFactory.createDocument(infile.toURL().toString());

    FileOutputStream fos = new FileOutputStream(outfile); 

    TransformerFactory tFactory = TransformerFactory.newInstance();     
    Transformer transformer = tFactory.newTransformer();        
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");

    DOMSource source = new DOMSource(doc);      
    StreamResult result = new StreamResult(fos);
    transformer.transform(source, result);
    fos.close();
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd";>
<svg xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink"; contentScriptType="text/ecmascript" contentStyleType="text/css" height="100%" kerning="0" preserveAspectRatio="xMinYMin meet" version="1.0" viewBox="0 0 3168 2448" width="100%" xml:space="preserve" zoomAndPan="magnify">

<style type="text/css" xml:space="preserve">
path {fill-rule:nonzero; stroke-linecap:round; stroke-linejoin:round}
rect {stroke-linejoin:miter}
text.t1 {font-family:'Times New Roman',serif;font-size:56;fill:#000000}
</style>

<g>
<text x="100" y="50%" class="t1">
Nim: a simple game
</text>
</g>

</svg>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to