RE: HELP ME! Getting xml filename and node path from diffrent xml document.

Subject: RE: HELP ME! Getting xml filename and node path from diffrent xml document.
From: "Carlberg, Anders" <Anders.Carlberg@xxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Sep 2000 01:15:58 +0200
Hello again..

Thank you, Saxon solves probably all my problems.

I have made some tests using Saxon, and now i have a question,
hope you dont mind. =)

This is a continuing on the last question.
I have used the: saxon:evaluate and then concat the doc2.xml with a XPath,
but how 
do i use saxon when i need a node-set in return.

I have tried things like this, 
(hope you understand what this supose to be) "It's in the same 'area' as my
last question.".

<xsl:for-each
select="saxon:evaluate(concat('$doc2','/xml/adressbook/entry'))">
	<xsl:value-of select="saxon:evaluate(concat('$doc2',name/.))" />
</xsl:for-each>


doc2.xml (updated)
 
 <xml>
	<adressbook>
		<entry>
			<name>Anders Carlberg</name>
 		</entry>> 	
		<entry>
			<name>Oliver Becker</name>
 		</entry>> 		
	</adressbook>
 </xml>
 

(i know this is a Saxon question, and this is a xslt-list, sorry...).
( next time i post it to the saxon-list )

Cheers.

/Anders Carlberg



-----Original Message-----
From: Oliver Becker [mailto:obecker@xxxxxxxxxxxxxxxxxxxxxxx]
Sent: den 29 augusti 2000 10:55
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: RE: HELP ME! Getting xml filename and node path from diffrent
xml document.


Good Morning Anders,

> (doc1.xml)
> 
> <xml>
> 	<textbox>
> 		<name>name</name>
> 		<value>/xml/adressbook/entry/name</value>
> 	</textbox>
> </xml>
> 
> 
> (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>

The following stylesheet works with Saxon:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:saxon="http://icl.com/saxon";
                exclude-result-prefixes="saxon"
                version="1.0">

<!-- Source1: given as processed XML source: contains XPaths -->

<!-- Source2: given via parameter          : contains Names  -->
<xsl:param name="file2" />
<xsl:variable name="doc2" select="document($file2)" />

<xsl:template match="xml">
   <xml>
      <xsl:apply-templates />
   </xml>
</xsl:template>

<xsl:template match="textbox">
   <textbox name="{name}" value="{saxon:evaluate(concat('$doc2',value))}" />
</xsl:template>

</xsl:stylesheet>

Invoking:
saxon doc1.xml anders.xsl file2=doc2.xml

I hope you understand this code. If you still have questions, feel free
to ask. As I said in the last post: it's an extension of Saxon, it's not
possible in the XSLT standard.

> 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.

I'm not that familiar with Xalan.
If it implements a similiar extension, maybe somebody on this list
can comment.

Best regards,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  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


Current Thread