hi, i'm trying to apply the following XSL to documents. it adds a <SPAN></SPAN> tag around all text nodes.
<xsl:transform version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xhtml" omit-xml-declaration="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="text()" priority="2"> <span lx="" ly="" ux="" uy=""> <xsl:copy/> </span> </xsl:template> <xsl:template match="node()"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:transform> the java code to do it looks like this: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder builder = dbf.newDocumentBuilder(); Document xslDoc = builder.parse(xsl); DOMSource xslDomSource = new DOMSource(xslDoc); xslDomSource.setSystemId(xsl); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(xslDomSource); DOMSource input = new DOMSource(dom); input.setSystemId(url); DOMResult output = new DOMResult(); transformer.transform(input, output); the input Document is an HTML page parsed by NekoHTML. anyway, this code works for most pages but sometimes i get the following error: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces. this happens for www.netsol.com and some other pages i'm trying to parse. i'm basically a newbie at this stuff so i have no idea where to look to fix this error. can someone help? thank you very much. ps. i'm using Xalan 2.6.0, Xerces 2.6.2, and Java 1.4.2_06. -- Xiaolei
