Two namespace-questions 2007-05-09 - By Kai W?rner
Back Hi all,
I'm trying to transform a XML-File that lies in a Namespace ("http://www.tei-c.org/ns/1.0") to SVG. Since the things I want are a pain to implement in XSLT, I switched to Java/JDOM, but now I'm in namespace hell:
The first question: In XSLT (2.0), I can deal with the TEI-namespace by declaring xpath-default-namespace="http://www.tei-c.org/ns/1.0" - then my xpath-expressions work fine without the need to append any prefixes. Is there anything like that I can do with JDOM? Every xpath-expression I try delivers zero results, regardless of whether I use prefixes or not.
The second question: The resulting SVG-File needs to have a root element that defines namespaces like this
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg">
or it won't render in a browser or open in inkscape. I can get the first declaration in JDOM via
Namespace svg = Namespace.getNamespace("svg","http://www.w3.org/2000/svg"); svgRoot.addNamespaceDeclaration(svg);
and the second one via
Namespace svg2 = Namespace.getNamespace("http://www.w3.org/2000/svg"); svgRoot.setNamespace(svg2);
, but using the second one adds a
xmlns=""
to every Element I create. Is there any comprehensible way to declare the namespaces without getting this?
Thanks,
Kai __ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
|
|