Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Can somebody help me in Xpath Querry [Thread Next] Re: Can somebody help me in Xpath QuerryTo: NULL Date: 4/1/2007 6:19:00 PM Thank you very much, but i figure out the prb if u want solution i can post it. Once again thank you......................i really appreciate your efforts ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- On Apr 1, 6:25 am, "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote: > "Bhavin" <v2desper...@gmail.com> wrote in message > > news:1175375390.513236.294300@y...... > > > > >I had to find " Teams which do not have defenders." > > > My XML file Look this way > > > <playoffs> > > <team id="ID0"> > > <name>Legia</name> > > </team> > > <team id="ID1"> > > <name>Brazil</name> > > </team> > > <team id="ID2"> > > <name>ManU</name> > > > <player id="101" team-id="ID0" dob="string" role="GoalKeeper"> > > </player> > > <player id="102" team-id="ID0" dob="string" role="Attack"> > > </player> > > <player id="103" team-id="ID0" dob="string" role="Defense"> > > </player> > > > <player id="201" team-id="ID1" dob="string" role="GoalKeeper"> > > </player> > > <player id="202" team-id="ID1" dob="string" role="Attack"> > > </player> > > <player id="203" team-id="ID1" dob="string" role="Defense"> > > </player> > > > <player id="a1" team-id="ID2" dob="string" role="GoalKeeper"> > > </player> > > <player id="a2" team-id="ID2" dob="string" role="Attack"> > > </player> > > <player id="a3" team-id="ID2" dob="string" role="Attack"> > > </player> > > > </playoffs> > > > When I Write the above Xpath query in this manner > > > 1] /playoffs/team[@id != /playoffs/player[@role="Defense"]/@team-id]/ > > name > > -this querry only works when there is only 1 defense including all > > the team > > - When there is 1 defense in each team it is showing me all teams > > > But over here i need the output TEAM " ManU" who does not have any > > defender > > > i dont know i am somewhere wrong..................plz help me if u can > > I really appreciated your efforts..........I know this querry is > > little bit Confusing > > > Thank you > > You are using != instead of not(). The former, in this usage instance, means > that there are some nodes that satisfy the condition, the latter means that > no nodes do. > ( I added a closing team tag to the example XML after the ManU team.) > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:template match="/"> > <defenderLessTeams> > <xsl:apply-templates select="playoffs/team[not(@id = > /playoffs/player[@role='Defense']/@team-id)]"/> > </defenderLessTeams> > </xsl:template> > > <xsl:template match="team"><xsl:copy-of select="."/></xsl:template> > </xsl:stylesheet> > > -- > > Joe Fawcett (MVP - XML)http://joe.fawcett.name | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
