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]

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


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

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