RE: [xsl] XSL manipulating two XMLs

Subject: RE: [xsl] XSL manipulating two XMLs
From: "Najmi, Jamal" <Jamal.Najmi@xxxxxxxxxxx>
Date: Wed, 1 May 2002 19:57:56 -0400
Yes, my two XML documents and XSL file are in the same directory.

I tried the '/' but it did not work. I think my problem comes even before
that, when the document is read by the transformer.  Transformer is looking
in the processor's directory.

I have tried implementing the URIResolver and Source interfaces, but I am
still geting errors.  

Here is the listing of my implementation classes:

import javax.xml.transform.URIResolver; 
import javax.xml.transform.TransformerException ; 
import javax.xml.transform.Source; 

 public class URIResolverImpl implements URIResolver {
 	private final static String  FILE_SEPARATOR_PROPERTY =
System.getProperty("file.separator") ;
 	private String _workingDirPath = null ;
 	public URIResolverImpl(String workingDirpath) {
 		_workingDirPath = workingDirpath ;
 	public Source resolve(String href, String base) throws
TransformerException {
 		href  = _workingDirPath + FILE_SEPARATOR_PROPERTY + href ;
 		System.out.println("href in URIResolver: " + href) ;
 		Source source = new SourceImpl(href) ;
 		return source ;



import javax.xml.transform.Source; 

 public class SourceImpl implements Source {
 	private final static String  FILE_SEPARATOR_PROPERTY =
System.getProperty("file.separator") ;
 	private String _systemId = null ;
 	public SourceImpl(String systemId) {
 		_systemId = systemId ;
 	public void setSystemId(String systemId) {
 		System.out.println("System id in set"  + systemId) ;
 		// ignore it
 	public String getSystemId() {
 		System.out.println("system id in get: " + _systemId ) ;
 		return _systemId ;

Now here is what getSystemId() returned and what got set in the URIResolver
when application ran.  This is from the standard output of tomcat.  Does
this output give any idea if I am setting something wrong in the
implementation classes?   

href in URIResolver:
system id in get:
system id in get:

Here is the error meesage:

SystemId Unknown; Line 50; Column 35; Can not load requested doc: Not
supported: com.artesia.cus

Will really appreciate any help!!!


-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@xxxxxxxx]
Sent: Wednesday, May 01, 2002 11:51 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] XSL manipulating two XMLs

Najmi, Jamal wrote:
> I am using xalan for transformation in tomcat servlet engine.  I copy the
> two XML files and the XSL to a directory created on the fly, import one
> file into XSL and pass the other one via the Xalan API.  Every thing shoud
> work except that XSL transformer starts looking for the imported XML file
> not in the currtent directory but in the TOMCAT_HOME/bin directory!!! I
> tried putting ./ infront of the imported file name but no use.  
> Hoe can I make the transformer look into the current directory for the
> included file: 

It seems it actually looked into the current working directory
for the process.

> Here is how  I am importing the XML document:
> <xsl:variable name = "contentXml" select ="document('content.xml')"/>

I'm unsure what you situation you acutally have. If both
the XML file passed to the transformer object and the file
referenced by the document() function are in the same directory,
   <xsl:variable name = "contentXml" select ="document('content.xml',/)"/>
No quotes arount the slash, it denotes the root node of
the XML document you passed to the transformer object.

BTW you are supposed to trim unnecessary "original messages"
from time to time.


 XSL-List info and archive:

 XSL-List info and archive:

Current Thread