P
picander77
Hello!
I need to perform the following operation on an XML document: I have a
first element containing a list of team (<Teams>). A name is assigned
to all teams, as well as a list of their members.
In a second element, I have a list of tables, and the people sitting on
those tables. The people sitting on the tables are always teams, but
the team's names are not stored in the element <Table>. Notice that the
names could not always be in the same order.
How can I perform a transformation using xslt/xpath to retrieve the
team's names assigned to the table?
The results should be like:
Table 1: Team Tiger-Lillys
Table 2: Team Brooklyn
Table 3: Team Queens
Here is an XML Sample.
<Lunch>
<Teams>
<Team name="Tiger-Lillys">
<Members>
<Member name="John"/>
<Member name="Mike"/>
<Member name="Joe"/>
<Member name="Mani"/>
</Members>
</Team>
<Team name="Brooklyn">
<Members>
<Member name="David"/>
<Member name="Isaac"/>
<Member name="Daniel"/>
</Members>
</Team>
<Team name="Queens">
<Members>
<Member name="Daniela"/>
<Member name="George"/>
<Member name="Kevin"/>
</Members>
</Team>
</Teams>
<Tables>
<Table number=1>
<Members>
<Member name="John"/>
<Member name="Mike"/>
<Member name="Joe"/>
<Member name="Mani"/>
</Members>
</Table>
<Table number=2>
<Members>
<Member name="David"/>
<Member name="Isaac"/>
<Member name="Daniel"/>
</Members>
</Table>
<Table number=3>
<Members>
<Member name="Daniela"/>
<Member name="George"/>
<Member name="Kevin"/>
</Members>
</Table>
</Tables>
</Lunch>
I need to perform the following operation on an XML document: I have a
first element containing a list of team (<Teams>). A name is assigned
to all teams, as well as a list of their members.
In a second element, I have a list of tables, and the people sitting on
those tables. The people sitting on the tables are always teams, but
the team's names are not stored in the element <Table>. Notice that the
names could not always be in the same order.
How can I perform a transformation using xslt/xpath to retrieve the
team's names assigned to the table?
The results should be like:
Table 1: Team Tiger-Lillys
Table 2: Team Brooklyn
Table 3: Team Queens
Here is an XML Sample.
<Lunch>
<Teams>
<Team name="Tiger-Lillys">
<Members>
<Member name="John"/>
<Member name="Mike"/>
<Member name="Joe"/>
<Member name="Mani"/>
</Members>
</Team>
<Team name="Brooklyn">
<Members>
<Member name="David"/>
<Member name="Isaac"/>
<Member name="Daniel"/>
</Members>
</Team>
<Team name="Queens">
<Members>
<Member name="Daniela"/>
<Member name="George"/>
<Member name="Kevin"/>
</Members>
</Team>
</Teams>
<Tables>
<Table number=1>
<Members>
<Member name="John"/>
<Member name="Mike"/>
<Member name="Joe"/>
<Member name="Mani"/>
</Members>
</Table>
<Table number=2>
<Members>
<Member name="David"/>
<Member name="Isaac"/>
<Member name="Daniel"/>
</Members>
</Table>
<Table number=3>
<Members>
<Member name="Daniela"/>
<Member name="George"/>
<Member name="Kevin"/>
</Members>
</Table>
</Tables>
</Lunch>