xsl-list
[Top] [All Lists]

RE: Transforming using DOMSource and DOMResult

2003-08-10 09:27:38
I don't know why it's failing. You haven't supplied enough information.
I can only assume that your stylesheet A.xsl is incorrect, unless you
provide evidence to the contrary!

If you think it's a bug in the XSLT processor then (a) it would be
interesting to know which XSLT processor you are using, and (b) it would
be interesting to know whether other JAXP-compliant processors produce a
different result.

Generally it is not a good idea to supply the JAXP input as a DOMSource
unless you have a particularly good reason for using DOM (that is, if
you want to use DOM APIs to access the data). If the input is a raw XML
document (characters or bytes) then it's best to supply it as a
StreamSource, which gives the XSLT processor maximum freedom to build
the tree representation any way it likes. If you are going to use the
result object as the source of another transformation then it's probably
best, in general, to use SAX to connect the two transformations. 

Michael Kay


-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
John(_dot_)Coffie(_at_)Anthem(_dot_)com
Sent: 08 August 2003 21:23
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Transforming using DOMSource and DOMResult


I apply a stylesheet (lets call it A.xsl) to an xml documet 
generating another stylesheet (called B.xsl) in memory. 
Everything appears to work fine however on closer inspection 
it is clear that the output B.xsl is wrong. A.xsl uses a 
series of conditional statements to include other stylesheets 
in B.xsl. All actions wrapped by conditional statements (this 
includes xsl:include statements and other instructions) are 
ignored, while all others are executed correctly. Below is 
the snipet of my transformation code. I will be glad to 
forward my .xml and .xsl documents if anyone is interested in 
looking at this issue. Any help will be appreciated.


TransformerFactory tFactory = TransformerFactory.newInstance();

      if (tFactory.getFeature(DOMSource.FEATURE) && 
tFactory.getFeature(DOMResult.FEATURE)){

        DocumentBuilderFactory dFactory = 
DocumentBuilderFactory.newInstance();

        dFactory.setNamespaceAware(true);

        DocumentBuilder dBuilder = dFactory.newDocumentBuilder();

        Document xslDocument = dBuilder.parse(xslFile);

        DOMSource xslDomSource = new DOMSource(xslDocument);

        transformer = tFactory.newTransformer(xslDomSource);

        DOMResult xslDomResult = new DOMResult();

        transformer.transform(new DOMSource(xmlDocument), 
xslDomResult);






CONFIDENTIALITY NOTICE: This e-mail message, including any 
attachments, is for the sole use of the intended recipient(s) 
and may contain confidential and privileged information or 
otherwise protected by law.  Any unauthorized review, use, 
disclosure or distribution is prohibited.  If you are not the 
intended recipient, please contact the sender by reply e-mail 
and destroy all copies of the original message.




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>