[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

simplifying the XSL for an intersection

Subject: simplifying the XSL for an intersection
From: "leona s" <lrs@xxxxxxxxxxxx>
Date: Mon, 13 Jan 2003 14:55:13 -0600
xsl intersection
Hi All,

I am trying to get a set of nodes that is really an intersection
and would appreciate some ideas for a solution.

What I need is the set of Matrix/Role nodes,
  that contains all of Roles for Items
  where $player is in at least one of the Roles for that Item.

For example, if I have a variable $player = '53', I
should get the set of Roles where roleID = {W,X,Y}, because
53 is in W and Y, and although 53 is not in X, that Role
is in at least one Item that also has roles W and Y. Also,
53 is in Role Z, but that Role does not belong to any Item so it is not
included.

I have a solution that works, but I was wondering if there is a simpler
way to express this.

<xsl:variable name="player" select="53"/>
<xsl:variable name="matrix" select="document('matrix.xml')"/>
<xsl:variable name="playerroles"
select="$matrix/Matrix/Role[PlayerLink/@player=$player]"/>
<xsl:variable name="matrixroles"
select="$matrix/Matrix/Role[@roleID=$matrix/Matrix/Item/RoleLink/@iRoleID[..
/../RoleLink/@iRoleID=$playerroles/@roleID]]"/>

<Matrix>
  <Role roleID="W">
    <PlayerLink player="1"/>
    <PlayerLink player="3"/>
    <PlayerLink player="6"/>
    <PlayerLink player="53"/>
  </Role>
  <Role roleID="X">
    <PlayerLink player="1"/>
    <PlayerLink player="3"/>
  </Role>
  <Role roleID="Y">
    <PlayerLink player="1"/>
    <PlayerLink player="3"/>
    <PlayerLink player="51"/>
    <PlayerLink player="53"/>
  </Role>
  <Role roleID="Z">
    <PlayerLink player="3"/>
    <PlayerLink player="53"/>
  </Role>

  <Item iID="123">
    <RoleLink iRoleID="W"/>
    <RoleLink iRoleID="X"/>
    <RoleLink iRoleID="Y"/>
  </Item>

  <Item iID="456">
    <RoleLink iRoleID="X"/>
    <RoleLink iRoleID="Y"/>
  </Item>

  <Item iID="789">
    <RoleLink kgRoleID="Y"/>
  </Item>
</Matrix>

Thanks very much,
Leona Slepetis
lrs@xxxxxxxxxxxx




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.