batik is probably not responsible for the following problem, but it happens while using batik and I'm sure one of you can help me:
I have a xslt-file (test2.xsl) which is supposed to act as an 'template' for svg-files:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<svg xmlns="http://www.w3.org/2000/svg" width="480" height="640">
<defs> <polygon id="Arrow" points="0.5,0 1,1 0,1"/> </defs>
<!-- Arrow up -->
<use id="up" fill="#C0C0C0" xlink:href="#Arrow" transform="scale(220, 10)"/>
<!-- Arrow down -->
<use id="down" fill="#C0C0C0" xlink:href="#Arrow" transform="translate(0,180) scale(220, 10) rotate(180, 0.5, 0.5)"/>
</svg>
</xsl:template>
</xsl:stylesheet>
I read this file into java and do a transformation on it:
JDOMResult out = new JDOMResult();
try {
StreamSource ss = new StreamSource(this.getClass().getResourceAsStream("test2.xsl"));
Transformer transformer = TransformerFactory.newInstance().newTransformer(ss);
transformer.transform(new JDOMSource(getActualLocation()), out);
} catch (Exception e) {
logger.warning("XSLT Transformation failed: " + e);
}
DocType type = new DocType("svg",
"-//W3C//DTD SVG 1.0//EN",
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd");
out.getDocument().setDocType(type); System.out.println("Document: " + out.getDocument()); System.out.println("Document: " + out.getResult());
XMLOutputter fmt = new XMLOutputter(); fmt.setIndent(" "); fmt.setNewlines(true);
FileWriter fw = new FileWriter("test.svg"); fw.write(fmt.outputString(out.getDocument())); fw.close();
But unfortunatly I get the following warnings while transforming the xslt-file:
XSLT Transformation failed: javax.xml.transform.TransformerException: org.jdom.IllegalNameException: The name "xlink:href" is not legal for JDOM/XML attributes: Attribute names cannot contain colons.
And in the result of the transformation, the <use .... > are missing:
<?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" height="640" width="480">
<defs>
<polygon points="0.5,0 1,1 0,1" id="Arrow" />
</defs>
</svg>
Does one of you have an idea what to do?
Thanks,
Rufus
-- '""'" ( o o ) -----------------------oOOo--(__)----oOOo------------- Rufus J.W. Buschart BOSCH
Robert Bosch Corporation Research and Technology Center RTC 4009 Miranda Avenue Palo Alto, CA 94304 United States Phone: 650-320-2967 Fax: 650-320-2925
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]