This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: XSL manipulating two XMLs


Laura and the rest,

I did what was suggested in this e-mail regarding handling two XML source
files with one XSL.  
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: 

Here is how  I am importing the XML document:

<xsl:variable name = "contentXml" select ="document('content.xml')"/>

Here is the error logged by Tomcat:

SystemId Unknown; Line 50; Column 35; Can not load requested doc: File
"file:///u01/tomcat/bin/content.xml" not found.



My transfomration works fine if I use xalan command line prompt, it fails
only when xalan API is used in the JSP. 

I will really appreciate any help I can get.  I really need it. 

Thanks!!

Jamal   



-----Original Message-----
From: Laura Jenkins [mailto:xsl_list@hotmail.com]
Sent: Thursday, April 18, 2002 3:40 PM
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] XSL manipulating two XMLs


i Donno the exact solution for your question i am afraid. But I think of 
something here
1. XSL is always for a fixed XML structure. so by the time u write xsl, you 
need to have the XML ready with you. so it makes more sence to have the XML 
included into ur XSL .
Now if you want to Dynamically do this, Then u may consider something like 
this.
generate the both the XMLs in ur servlet and store it in some directory.
now you can make the XSL point to those files (xml files) and get the stuff 
rlling.With this, you would have dynamically generated XML files included 
into your XSL. You should make sure the name you give while generating the 
XML files are same as the once u call in the XSL. as long as this is 
maintained. you would have your XSL running for dynamically generated XML 
too
Here U only need to import one of those files because the other one would 
anyway be the source XML file for your transformation.
so try doing this.

HTH

>From: "Najmi, Jamal" <Jamal.Najmi@Artesia.com>
>Reply-To: xsl-list@lists.mulberrytech.com
>To: "'xsl-list@lists.mulberrytech.com'" <xsl-list@lists.mulberrytech.com>
>Subject: RE: [xsl] XSL manipulating two XMLs
>Date: Thu, 18 Apr 2002 09:58:17 -0400
>
>Hi Vasu,  Thanks for the detailed response.
>
>It looks like the XMLs will have to be inclused inside the XSL code.  I 
>have
>a scenario where same servlet code should be able to handle two XMLs and an
>XSL dynamically ie. provide two XMLs and an XSL to the servlet and it will
>apply the XSL to the XMLs.  Is it possible.  With one XSL and one XML is is
>possible.
>
>Thanks
>
>Jamal
>
>
>-----Original Message-----
>From: Vasu Chakkera [mailto:vasucv@hotmail.com]
>Sent: Thursday, April 18, 2002 2:41 PM
>To: xsl-list@lists.mulberrytech.com
>Subject: RE: [xsl] XSL manipulating two XMLs
>
>
>Hi jamal it is very much possible. This is done using document.
>u have to give the XML file name/location as a parameter.
>
>example
>statement1
><xsl:variable name = "xml1" select ="document('xmlfile1.xml')"/>
>statement2
><xsl:variable name = "xml2" select ="document('xmlfile2.xml')"/>
>and
><xsl:apply-templates select = "$xml1"/>
>or
><xsl:for-each select = "$xml1/Root-Element-of-xml1">
>
>REMEMBER : when u  call the documents like this u should always refer to 
>the
>
>elements by the name of the variable that is made use of to load the XML
>file .(in the above case its xml1)
>so if u want to iterate through each of the elements in your external XML
>element, for example in the above case XML1.xml and if the root element of
>this xml is root-xml1 then this root is refered to as
>$xml1/root-xml1
>where
>$xml1 is defined in the statement1 above.
>
> >
> >I am using xalan for transformatrion in servlets.  How would that work 
>with
> >the xalan API?  Is there API to associate two XML sources with one XSL
> >source?
> >
>
>You dont need any separate API to do this just call the document within the
>XSL sheet. like above.
>and the run the XALAN transformation command to transform.please let us 
>know
>
>if u want any more details regarding this.
>HTH
>vasu
>
>
> >From: "Najmi, Jamal" <Jamal.Najmi@Artesia.com>
> >Reply-To: xsl-list@lists.mulberrytech.com
> >To: "'xsl-list@lists.mulberrytech.com'" <xsl-list@lists.mulberrytech.com>
> >Subject: RE: [xsl] XSL manipulating two XMLs
> >Date: Thu, 18 Apr 2002 09:19:50 -0400
> >
> >Thanks for the quick response!
> >
> >I am using xalan for transformatrion in servlets.  How would that work 
>with
> >the xalan API?  Is there API to associate two XML sources with one XSL
> >source?
> >
> >Jamal
> >
> >
> >
> >-----Original Message-----
> >From: cutlass [mailto:cutlass@secure0.com]
> >Sent: Thursday, April 18, 2002 1:57 PM
> >To: xsl-list@lists.mulberrytech.com
> >Subject: Re: [xsl] XSL manipulating two XMLs
> >
> >
> >uhhh,
> >
> >use the document() command to bring in your xml
> >
> >
> >for example
> >
> ><xsl:variable name="doc1" select="document('test1.xml')"/>
> >
> ><xsl:variable name="doc2" select="document('test2.xml')"/>
> >
> >
> >then apply your transform to $doc1 or $doc2
> >
> >for example;
> >
> ><xsl:apply-templates select="$doc1"/>
> ><xsl:apply-templates select="$doc2"/>
> >
> >
> >gl, jim fuller
> >
> >----- Original Message -----
> >From: "Najmi, Jamal" <Jamal.Najmi@Artesia.com>
> >To: <xsl-list@lists.mulberrytech.com>
> >Sent: Thursday, April 18, 2002 1:43 PM
> >Subject: [xsl] XSL manipulating two XMLs
> >
> >
> > > Is it possibe to transform two separate XMLs with the same XSL to 
>create
> >an
> > > HTML page where data is coming from two XMLs based on some rules 
>defined
> >by
> > > the XSL.
> > >
> > > Thanks
> > >
> > > Jamal
> > >
> > > -----Original Message-----
> > > From: Michael Kay [mailto:michael.h.kay@ntlworld.com]
> > > Sent: Thursday, April 18, 2002 10:06 AM
> > > To: xsl-list@lists.mulberrytech.com
> > > Subject: RE: [xsl] setting global parameter in one template and
> > > accessing in another
> > >
> > >
> > > > Is it possible to set a global parameter in one template and
> > > > retrieve its
> > > > value in another template?
> > > >
> > >
> > > No, XSLT is a declarative language and therefore does not allow 
>variable
> > > assignment. Tell use what your problem is, and someone will tell you 
>how
> >to
> > > solve it declaratively.
> > >
> > >
> > > Michael Kay
> > > Software AG
> > > home: Michael.H.Kay@ntlworld.com
> > > work: Michael.Kay@softwareag.com
> > >
> > >
> > >  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
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
>
>
>_________________________________________________________________
>Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]