This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: HELP ME! Getting xml filename and node path from diffrent xml doc ument.
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: HELP ME! Getting xml filename and node path from diffrent xml doc ument.
- From: "Carlberg, Anders" <Anders dot Carlberg at infologigruppen dot se>
- Date: Mon, 28 Aug 2000 20:06:07 +0200
- Reply-To: xsl-list at mulberrytech dot com
Hi Oliver.
First, Thanks for your reply.
Here a are a example.
First document contains this:
(doc1.xml)
<xml>
<textbox>
<name>name</name>
<value>/xml/adressbook/entry/name</value>
</textbox>
</xml>
Second documnet:
(doc2.xml)
<xml>
<adressbook>
<entry>
<name>Anders Carlberg</name>
</entry>
<adressbook>
</xml>
Note that the value text() in doc1.xml is the "path" to the name in
doc2.xml.
My question is. How can i use a xsl to get a result that would look somthing
like this.
<xml>
<textbox name="name" value="Anders Carlberg" />
</xml>
What im looking for is a way to read the "path" in doc1.xml and use it to
get the value from
doc2.xml. This is my problem.
Im using Xalan today, but it dosen't matter what i use.
(Xalan implements xsl and xpath spec i think).
I havent used saxon at all, so im going to take a look now.
Cheers
/Anders
-----Original Message-----
From: Oliver Becker [mailto:obecker@informatik.hu-berlin.de]
Sent: Monday, August 28, 2000 4:26 PM
To: xsl-list@mulberrytech.com
Subject: Re: HELP ME! Getting xml filename and node path from diffrent
xml doc ument.
Hi Anders,
> How should i solve this problem.
> I have search thru XST faq/ XSLT news, but i cant find anything who can
help
> me with this..
>
> I have two XML sources, one xslt.
> I want to get the document name (ex. document1.xml) from one xml document
> and
> the path (node-path ex. \xml\name) from the other xml document.
>
> Doing this using document() or other function/method.
It's a little bit difficult to guess what your documents actually look
like. Maybe an example would be very helpful.
It's no problem to open and read an other XML document via the
document function. The parameter (the file name) can be obtained
from your XML source.
Your second question seems to be more problematic.
Am I right in assuming that the XPath expression is part of your
XML source?
Something like
<root>
<expression path="/foo/bar[@att='value']" />
</root>
XSLT doesn't have a facility to evaluate XPath expressions dynamicly,
i.e. they must be a static part of the stylesheet.
The Saxon processor provides an extension function saxon:evaluate()
that closes this gap.
http://users.iclway.co.uk/mhkay/saxon/extensions.html#evaluate
Hope this helps,
Oliver
/-------------------------------------------------------------------\
| ob|do Dipl.Inf. Oliver Becker |
| --+-- E-Mail: obecker@informatik.hu-berlin.de |
| op|qo WWW: http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list