[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Recursive counting
Welp, a morning and an afternoon later I'm no closer to applying this solution. Here's what I've got. What on earth is happening? ---------- <xsl:key name="options" match="option" use="@type"/> <xsl:key name="oldID" match="option" use="@oldID"/> <xsl:key name="prefs" match="disabPrimary" use="."/> <xsl:template match="Records" mode="x"> <xsl:for-each select="document('../../Consumer.xml')/defs/disabs/option[generate-id(.)=generate-id(key('options',@type)[1])]"> <xsl:sort select="@type"/> <tr> <td> <xsl:value-of select="@type" /> </td> <td> <xsl:value-of select="count(key('oldID',key('options',@type)/@oldID))" /> <xsl:value-of select="count(key('prefs',$vP2//Record[disabPrimary=@oldID])))" /> <xsl:value-of select="count(key('prefs',key('options',@type)/@oldID))" /> </td> </tr> </xsl:for-each> --- and later .... <xsl:apply-templates select="document('../../Consumer.xml')/cilDefinitions/disabilities" /> ------ XML (within variable $vP2 ) <Records> <Record> <disabPrimary>101</disabPrimary> </Record> <Record> <disabPrimary>401</disabPrimary> </Record> <Record> <disabPrimary>201</disabPrimary> </Record> and within Consumer.xml ....... <option oldID="204" type="Cognitive" name="Alzheimer's/Dementia"/> <option oldID="407" type="Physical" name="Amputation"/> <option oldID="405" type="Physical" name="Arthritic Conditions"/> <option oldID="101" type="Cognitive" name="Autism"/> <option oldID="100" type="Visual" name="Blind"/> --------- Desired output <out type="Cognitive" count="X" /> <out type="Physical" count="X" /> <out type="Visual" count="X" /> <!--- X = count of times @oldID=disabPrimary of @type Cognitive --> -Steve ---------------------- XSL Related Suicide. On 7/18/06, Steve <subsume@xxxxxxxxx> wrote: Well after success with my first recursive template I was all set to make one of my own, but now shamefully am coming to the list for advice over something that appears quite simple.
|
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
|