Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Xalan document() function finding wrong document root

Reply
Thread Tools

Xalan document() function finding wrong document root

 
 
Steve Carrow
Guest
Posts: n/a
 
      07-28-2003
Hello,

I'm trying to write a web app where an XML source file is transformed
by an XSL document via a Java 1.4.1 servlet. Development is under WSAD
5 on Windows 2000. The XSL document refers to another XML file in the
same directory as the source; that is done via a:
"document(concat($other_file, ''), .)" call, where $other_file was
defined by:

<xslaram name="other_file">other_file.xml</xslaram>

My reading has led me to believe that that is the way to access the
XML file if it is in the same directory as the source. This did work
under XMLSPY (only after I added the "concat" call; didn't seem to
like RTFs), but under the Websphere Application Development
environment, 'other_file.xml' is searched for under the installation
directory. This also occurs under Tomcat 4.1. This seems just wrong
and may be linked to the Java code invoking the transformation, a
synopsis of which follows:

URL xslURL = getServletContext().getResource("/xsl/subdir/file.xsl");
StreamSource xslSource = new StreamSource(xslURL.openStream());
URL xmlURL = getServletContext().getResource("/xml/file.xml");
StreamSource xmlSource = new StreamSource(xmlURL.openStream());
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(xslSource);
//
// (Parameter fill-in)
//
transformer.setParameter("other_file", "other_file.xml");
//
//
transformer.transform(xmlSource, new StreamResult(out));

My guess is that not enough info to truly establish a base URI is
being passed into the transformer. If so, my question has two parts:

- How can I pass the URI info in?
- Why is that not the default behavior? As it stands, the document()
function behavior clearly seems to contradict both the standard and
Michael Kay.-))

Thanks for any help on this,
Steve Carrow
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Xalan, Xerces Problem finding Default Provider Mark F Java 0 03-07-2005 07:02 PM
Upgrade of Xalan 1.2.2 and Xerces 1.4.4 to Xalan 2.6 and Xerces 2.6.2 cvissy XML 0 11-16-2004 07:06 AM
can i create a xalan java extension function where the function name has dashes (-) in it ? _clb_ Chris Bedford Java 0 08-17-2003 12:57 AM
can i create a xalan java extension function where the function name has dashes (-) in it ? _clb_ Chris Bedford XML 0 08-17-2003 12:57 AM
Xalan document() function finding wrong document root Steve Carrow XML 0 07-28-2003 02:28 AM



Advertisments