|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: simplifying the XSL for an intersection
Hello Leona,
isn't it possible that your requirement gets out of hand? For example I add an Item like the following: <Item iID="1">
<RoleLink iRoleID="X"/>
<RoleLink iRoleID="A"/>
</Item>and a simple Role like the following: <Role roleID="A">
<PlayerLink player="1"/>
<PlayerLink player="3"/>
</Role>A won't be caught in the first run, but maybe it has to, because it's in the same Item as X. It seems that a recursive approach is needed, isn't it? Without recursion and not really simpler, but I think more readable and easier to understand is the following rewriting: <xsl:variable name="player" select="53"/> You can pull the root element <Matrix/> into the variable declaration of $matrix. So you avoid to type it always in the expressions below: <xsl:variable name="matrix" select="document('matrix.xml')/Matrix"/> <xsl:variable name="playerroles" select="$matrix/Role[PlayerLink/@player=$player]"/> Your expression was: <xsl:variable name="matrixroles" select="$matrix/Role[@roleID = $matrix/Item/RoleLink/@iRoleID [../../RoleLink/@iRoleID = $playerroles/@roleID]]"/> rewritten: <xsl:variable name="matrixroles" select="$matrix/Role[@roleID = $matrix/Item [RoleLink/@iRoleID = $playerroles/@roleID]/RoleLink/@iRoleID]"/> or adding a new variable for further better readability: <xsl:variable name="items" select="$matrix/Item[RoleLink/@iRoleID = $playerroles/@roleID]"/> <xsl:variable name="matrixroles" select="$matrix/Role[@roleID=$items/RoleLink/@iRoleID]"/> Does this help a bit? And what about my first comment? Regards, Joerg leona s wrote: Hi All, XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








