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

Pass XML document (*not* file path!) as parameter to X

Subject: Pass XML document (*not* file path!) as parameter to XSLT
From: "david bessire" <david_bessire@xxxxxxxxxxx>
Date: Fri, 18 May 2007 16:56:57 +0000
 Pass XML document (*not* file path!) as parameter to X
i found the solution to the problem discussed in my previous posting with the same subject.

i was able to pass the dynamically-generated org.dom4j.Document XML object as a parameter to the XSLT in Java code by doing the following:

1. convert the org.dom4j.Document to an org.w3c.dom.Document
2. get an org.w3c.dom.NodeList from the org.w3c.dom.Document
3. pass the NodeList using javax.xml.transform.Transformer setParameter method
4. make minor changes to the XSLT, since the NodeList isn't the full XML structure
of the original org.dom4j.Document object.


The verbatim code follows:

// create org.dom4j.Document permDoc ...
org.w3c.dom.Document d = new org.dom4j.io.DOMWriter().write(permDoc);
org.w3c.dom.NodeList nl = d.getDocumentElement().getChildNodes();
transformer.setParameter("permsroles", nl);


where "permsroles" is the XSLT parameter name references in the transform.

-db

_________________________________________________________________
Like the way Microsoft Office Outlook works? Youll love Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_outlook_0507


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-2011 All Rights Reserved.