XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Vishal SinghSubject: Fail!. Finding a parent node that matches a node from the list of nodes.
Author: Vishal Singh
Date: 23 Apr 2007 10:43 AM
Can I do this ? It doesn't works. I need to check that if one of the countries is an ancestor of the current node that I am in the xml document. So what I am trying is, to run a loop on countries and check if it matches any of the ancestors. I am working in MSXML. Are there any other options avaiable.

<xsl:variable name="countries">
<countries>
<country>Americas</country>
<country>Europe</country>
<country>Asia</country>
<country>Japan</country>
</countries>
</xsl:variable>

<xsl:for-each select="msxsl:node-set($countries)/countries/country ">
<xsl:variable name="x" select="key('items',$navid)/ancestor-or-self::item/title[contains(text() , .)]"></xsl:variable>
<xsl:value-of select="$x" />
</xsl:for-each>

Posttop
(Deleted User) Subject: Fail!. Finding a parent node that matches a node from the list of nodes.
Author: (Deleted User)
Date: 24 Apr 2007 09:18 AM
Hi Vishal,
have you tried using current() instead of '.' in the predicate? I think you want to run the contains() on the context set by the for-each, not on the title element....

Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.