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

RE: XSL manipulating two XMLs

Subject: RE: XSL manipulating two XMLs
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 2 May 2002 11:00:04 +0100
uriresolver domsource
You should never implement the Source interface; the processor will only be
able to use its own implementations. When you write a URIResolver, it should
return a DOMSource, SAXSource, or StreamSource, or any other specific Source
that the chosen processor says it will accept.

But you don't need a URIResolver here, you just need to make sure the XSLT
processor knows the base URI of the principal source document.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> Najmi, Jamal
> Sent: 02 May 2002 00:58
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  XSL manipulating two XMLs
>
>
> 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 ;
>  	}
>  }
>
> *******************************
>
> and
>
> 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:
> /u01/artesia/teamsdne/jamalsandbox/workingdir/1020296490674/co
> ntent.xml
> system id in get:
> /u01/artesia/teamsdne/jamalsandbox/workingdir/1020296490674/co
> ntent.xml
> system id in get:
> /u01/artesia/teamsdne/jamalsandbox/workingdir/1020296490674/co
> ntent.xml
>
> Here is the error meesage:
>
> SystemId Unknown; Line 50; Column 35; Can not load requested doc: Not
> supported: com.artesia.cus
> t.discovery.web.common.SourceImpl@437f31
>
> Will really appreciate any help!!!
>
> Jamal
>
>
> -----Original Message-----
> From: J.Pietschmann [mailto:j3322ptm@xxxxxxxx]
> Sent: Wednesday, May 01, 2002 11:51 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  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
> XML
> > 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,
> try:
>    <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.
>
> J.Pietschmann
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.