[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

JAXP - Ignoring whitespaces from a Node object passed

Subject: JAXP - Ignoring whitespaces from a Node object passed as parameter for XSLT transformation
From: Blue Gecko <bluegecko@xxxxxxxxx>
Date: Sat, 15 Oct 2005 21:54:31 +0200
gecko transformer
Hi all,

I'm facing with a problem concerning ignorable whitespace text nodes.

I use an XSLT stylesheet with the <xsl:strip-space elements="*"/> instruction in order to avoid any redundancy.
I pass a Node object (say: myNode -- see the attached code), obtained from an XPath evaluation, to the XSLT transformer as a parameter (named "siteMap"), but the resulting transformation preserves *just* and *only* the whitespaces coming from *that* parameter nodeset: it seems that the XSLT parser is unable to deal properly with pre-constructed nodesets.
I want to stress that the rest of the transformed content (from the main XML source) works perfectly (all whitespaces are stripped as expected).


Is this a standard-compliant behavior?
How can I force XPath resulting Node to ignore redundant whitespace text nodes?


Thanks in advance!

---------------------
My code snippet:

import javax.xml.transform.*;
import javax.xml.xpath.*;
import org.w3c.dom.*;
import org.xml.sax.*;

{

[snip]

// Define the XPath evaluator!
XPath xPath = XPathFactory.newInstance().newXPath();

// Get the DOM representation of the root node via XPath evaluation!
Node myNode = (Node) xPath.evaluate(
 "/rootTag",
 new InputSource(sourcePath + "siteMap.xml"),
 XPathConstants.NODE
 );

[snip]

// Get the page xslt transformer!
Transformer pageTransformer = TransformerFactory.newInstance().newTransformer(pageStyle);
pageTransformer.setParameter("siteMap", myNode);


[snip]

}

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.