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: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Sep 2000 09:54:11 +0200 (MET DST)
Hi Anders,

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

Maybe I'm missing something, but I think it's simpler than you expect:
<xsl:for-each
     select="saxon:evaluate(concat('$doc2','/xml/adressbook/entry'))">
	<xsl:value-of select="name" />
</xsl:for-each>

The for-each selects all entry elements. These build the context node-set.
>From that node-set you want the name children. 
There's no need to use saxon:evaluate once again.

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

Regards,
Oliver

BTW: name/. means name/self::node(), so that step is really unnecessary.
     Perhaps you had in mind name/text(), i.e. the text child of name.

/-------------------------------------------------------------------\
|  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


Current Thread