xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Dupras <bri...@centera.com>
Subject xslt with existing DOM nodes: HIERARCHY_REQUEST_ERR
Date Tue, 18 Jan 2000 16:59:24 GMT
Thanks for all the help I'm getting here with the apache xml/xsl
implementations.

I'm trynig to get (xml Node) + (xsl Node) => (xml Node) working, but I keep
getting an error.  Thanks Scott for the XercesLiaison() fix - it got me half
way.

The error I get now is:
 "org.apache.xerces.dom.DOMExceptionImpl: HIERARCHY_REQUEST_ERR"

I'm sending in two DOM nodes and want to receive a DOM node in return.
Following is a sample.

Brian


Code snippets:

private Element processElement(Element xmlelemTarget, 
                               Element xmlelemXSLT) 
                               throws SAXException 
{
	Document xmldocResult = new DocumentImpl();
	xsltProcessor.process(	new XSLTInputSource(xmlelemTarget), 
					new XSLTInputSource(xmlelemXSLT), 
					new XSLTResultTarget(xmldocResult)
					);
	return xmldocResult.getDocumentElement();
}


domParser =
(DOMParser)Class.forName("org.apache.xerces.parsers.DOMParser").newInstance(
);

xsltProcessor = XSLTProcessorFactory.getProcessor(new
org.apache.xalan.xpath.xdom.XercesLiaison());


thexml = parser.parse(fname).getDocument().getDocumentElement();
thexsl = parser.parse(fname).getDocument().getDocumentElement();

NodeList nl = thexml.getElementsByTagName("component");
...
thexmlElement = (Element)nl.item(i);

//throws exception HIERARCHY_REQUEST_ERR:
Element result = processElement(thexmlElement, thexsl);





The xml Node (Element) looks like this:
<component>
  <resource rid='abdcedfghi127_nons'/>
  <type rid='abdcedfghi002_nons'/>
  <params/>
</component>


The xsl Node (Document Element) looks like this:
<?xml version="1.0"?>

<xsl:stylesheet	
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:pp="http://medwired.com/namespaces/practiceportal/1.0"
	xmlns:xlink='http://www.w3.org/XML/XLink/0.9'
	exclude-result-prefixes="pp xlink"
	>
	<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
	
	<span>
		testing
	</span>
</xsl:stylesheet>


Brian Dupras
Centera Information Systems, Inc.
phone	303.939.0200 x294
fax	303.939.0111
web	http://www.centera.com
email	briand@centera.com

Mime
View raw message