473,473 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Xalan document() function finding wrong document root

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:

<xsl:param name="other_file">other_file.xml</xsl:param>

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
Jul 20 '05 #1
0 2752

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: al dav | last post by:
Hi all ok i am not a java programmer I am a sys-admin, my users want xalan and have already got j2sdk_1.4.2 so i have downloaded it and set the CLASS_PATH export...
1
by: Bekkali Hicham | last post by:
hi, i have already used xalan several times with success, but i have a error message that i don't understand, thanks for your help (Emplacement inconnu de l'erreur) Erreur XSLT...
1
by: Hyunchan Kim | last post by:
To indent xml file, I made an instance of Transformer from Templates using following. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
1
by: Brian J. Sayatovic | last post by:
I'm using Xalan-J to loop through some nodes with an xsl:for-each element, presumably in document order. As far as I can tell, the XSL speciciation says that a for-each element will loop through...
0
by: Francesc Guim Bernat | last post by:
Dear colleagues, i'm getting in troubles using one XML library with Visual Studio .NET and Xerces with Xalan. (Xercer 2.4 and Xalan 1.7) When i execute the code i get the next run time error: ...
1
by: Fisch von Gestern | last post by:
I have tried to run the extension function/element examples provided with the Xalan-J download. I believe that my classpath is correct, and that my versions are up-to-date. However, I can't get...
3
by: Avalon1178 | last post by:
Hi, I recently downloaded the xalan-c source code in http://mirrors.ccs.neu.edu/Apache/dist/xml/xalan-c I followed the instructions from the apache site on how to build it (I already have...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
2
by: lanegroups | last post by:
Dear experts, I'm trying to do the following using Xalan-C++ API 1. parse an XML document 2. evaluate an XML path 3. serialize the selected XML subtree 4. The new serialized XML fragment should...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.