Subject: [xsl] Dynamic attribute name in predicate - 2nd try From: "Dick Penny" <d_penny@xxxxxxx> Date: Fri, 07 Aug 2009 14:06:58 -0700 |
David et al., thanks for prior response. I thought brevity had a higher priority than completeness in my prior post. Let me try again. ****data sample******* <dsQueryResponse> <Rows> <Row GroupAssigned="CRA" Source="Other" Status="TBD" FW="" FM="" FQ="" FY="" /> <Row GroupAssigned="HR" Source="Other" Status="Accept" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="CRA" Source="EC_MailBox" Status="Accept" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="CRA" Source="EC_MailBox" Status="TBD" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="HR" Source="EC_MailBox" Status="Accept" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="CRA" Source="Other" Status="VettedOut" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="CRA" Source="EC_MailBox" Status="Accept" FW="12" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="HR" Source="Other" Status="Accept" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="CRA" Source="Other" Status="Accept" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="CRA" Source="EC_MailBox" Status="VettedOut" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="CRA" Source="AltertLine" Status="Accept" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="HR" Source="AltertLine" Status="VettedOut" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="Legal" Source="EC_MailBox" Status="VettedOut" FW="9" FM="JUN" FQ="1" FY="10" /> <Row GroupAssigned="Legal" Source="Other" Status="Accept" FW="9" FM="JUN" FQ="1" FY="10" /> </Rows> <dsQueryResponse> *************************************** I prefer to use English rather than a sample for output. I seek a table each of whose cells contains the count of a sub-set of input rows such that the sub-sets are mutually exclusive and collectively exhaustive. This table could be more than two dimensional by repeats in either row or column display. Each dimension represents sub-set formation according to one attribute in the input rows. I wish these sub-sets to be specified by so called bconvenience listsb or RTFs. My code below is successful where one dimension of predicate selector values, for example, comes from my D1 RTF. Instead I want to be able to take the whole predicate bname, valueb pair from an RFT. In my prior post, the unsuccessful part was trying to use element name as the attribute name, and element value as the selection value, but could not get the syntax correct. Since I can design the RTF as I wish, should I use attributes within it rather than element name and element value? ***********code minus formatting aspects <xsl:variable name="allRows" select="/dsQueryResponse/Rows/Row"/> <xsl:variable name="D1"> <GroupAssigned>CRA</GroupAssigned> <GroupAssigned>HR</GroupAssigned> <GroupAssigned>Legal</GroupAssigned> </xsl:variable> <xsl:variable name="D2"> <src>Other</src> <src>EC_MailBox</src> <src>AlertLine</src> </xsl:variable> <xsl:variable name="D3"> <month>AUG</month> <month>JUL</month> <month>JUN</month> <week>13</week> <week>12</week> <week>11</week> </xsl:variable> <xsl:template match="/"> <table class="newStyle1"> <xsl:for-each select="msxsl:node-set($D1)/GroupAssigned"> <tr> <td><xsl:value-of select="." /></td> <xsl:variable name="d1" select="."/> ????could not figure out how to pull @GroupAssigned using info in RTF???? ????also, did not understand why replacing $d1 with a dot failed since d1 was set to dot???? <xsl:variable name="d1Rows" select="$allRows[@GroupAssigned=$d1]"/> <xsl:for-each select="msxsl:node-set($D2)/src"> <xsl:variable name="d2" select="."/> <xsl:for-each select="msxsl:node-set($D3)/month"> <xsl:variable name="d3" select="."/> <xsl:call-template name="oneCellout"> <xsl:with-param name="cnt" select="count($d1Rows[@Source=$d2 and @FM=$d3])"/> </xsl:call-template> </xsl:for-each> </xsl:for-each> <tr> <td><xsl:value-of select="count($d1Rows)" /></td> </tr> </xsl:for-each> </table> </xsl:template> <xsl:template name="oneCellout" > <xsl:param name="cnt"/> <td><xsl:value-of select="$cnt"/></td> </xsl:template> ********************************** Thanks again. Dick Penny
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] RE: xsl transform on xml with, Raveendran, Reshma | Thread | [xsl] [xsl-fo] marker bug in FOP?, Geert Bormans |
RE: [xsl] Curious about creating a , Mario Madunic | Date | RE: [xsl] Re: RE: What are the diff, Michael Kay |
Month |