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

Dynamic attribute name in predicate - 2nd try

Subject: Dynamic attribute name in predicate - 2nd try
From: "Dick Penny" <d_penny@xxxxxxx>
Date: Fri, 07 Aug 2009 14:06:58 -0700
 Dynamic attribute name in predicate - 2nd try
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

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.