Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Can somebody help me in Xpath Querry

From: "Bhavin" <v2desperado@-----.--->
To: 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




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent