[Home] [By Thread] [By Date] [Recent Entries]
At 2006-08-02 13:41 -0400, Steve wrote:
Having some difficulty with output. Perhaps someone can shed some light as to why. It appears you were searching the wrong file and key table for the records.
The number above indicates the amount of times a disability with an oldID corresponding to the type in the first <td></td> appears in the whole of /Record/Record
Disab.xml ==>
I hope you find the example below helpful. Thank you for making it quick to review. . . . . . . . . . . Ken T:\ftemp>type Disab.xml
<?xml version="1.0" encoding="US-ASCII"?>
<disabilities>
<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="301" type="Cognitive" name="Autism"/>
<option oldID="100" type="Visual" name="Blind"/>
<option type="Physical" name="Blood disorders" />
<option oldID="413" type="Physical" name="Cancer"/>
<option oldID="400" type="Cognitive" name="Cerebral Palsy"/>
<option oldID="410" type="Physical" name="Chronic Fatigue Syndrome"/>
<option oldID="305" type="Cognitive" name="Cognitive-Other"/>
<option type="Physical" name="Cystic Fibrosis"/>
<option oldID="101" type="Hearing" name="Deaf"/>
<option oldID="302" type="Cognitive" name="Developmental/Mental
Retardation"/>
<option oldID="414" type="Physical" name="Diabetes"/>
<option oldID="411" type="Physical" name="Epilepsy/Seizure Dis."/>
<option type="Physical" name="Fibromyalgia"/>
<option oldID="101" type="Hearing" name="Hard of Hearing"/>
<option oldID="415" type="Physical" name="Heart Disease" />
<option type="Physical" name="Hepatitus"/>
<option oldID="416" type="Physical" name="HIV/AIDS"/>
<option type="Physical" name="Kidney disorder/renal failure"/>
<option oldID="300" type="Cognitive" name="Learning Disabilities"/>
<option oldID="" type="Physical" name="Lung
disease/disorders/conditions" />
<option oldID="202" type="Mental" name="Mental Health-Other"/>
<option oldID="200" type="Mental" name="Mental Illness/Emot.Dis"/>
<option oldID="418" type="Physical" name="Morbid Obesity"/>
<option oldID="417" type="Physical" name="Multiple Chemical
Sensitive"/>
<option oldID="420" type="Multiple" name="Multiple Disability"/>
<option oldID="403" type="Physical" name="Multiple Sclerosis"/>
<option oldID="402" type="Physical" name="Muscular Dystophy"/>
<option oldID="412" type="Physical" name="Neurological-Other"/>
<option oldID="500" type="None" name="None"/>
<option oldID="406" type="Physical" name="Orthopedic-Other"/>
<option oldID="419" type="Physical" name="Physical-Other"/>
<option oldID="410" type="Physical" name="Post-Polio"/>
<option oldID="404" type="Physical" name="Spinal Cord Disorders" />
<option oldID="404" type="Physical" name="Spinal Cord Injuries" />
<option oldID="409" type="Physical" name="Stroke/Cardiovascular"/>
<option oldID="201" type="Mental" name="Substance Abuse/Addiction"/>
<option oldID="303" type="Cognitive" name="Traumatic Brain Injury" />
<option oldID="" type="Visual" name="Visually Impaired"/>
</disabilities>T:\ftemp>type Records.xml
<?xml version="1.0" encoding="US-ASCII"?>
<Records>
<Record>
<disabPrimary>200</disabPrimary>
</Record>
<Record>
<disabPrimary>407</disabPrimary>
</Record>
<Record>
<disabPrimary>419</disabPrimary>
</Record>
<Record>
<disabPrimary>101</disabPrimary>
</Record>
<Record>
<disabPrimary>101</disabPrimary>
</Record>
<Record>
<disabPrimary>101</disabPrimary>
</Record>
<Record>
<disabPrimary>101</disabPrimary>
</Record>
<Record>
<disabPrimary>200</disabPrimary>
</Record>
<Record>
<disabPrimary>101</disabPrimary>
</Record>
</Records>T:\ftemp>call xslt steve.xsl steve.xsl steve.out T:\ftemp>type steve.out
<?xml version="1.0" encoding="utf-8"?>
<tr>
<td>Cognitive</td>
<td>0</td>
</tr>
<tr>
<td>Hearing</td>
<td>5</td>
</tr>
<tr>
<td>Mental</td>
<td>0</td>
</tr>
<tr>
<td>Multiple</td>
<td>0</td>
</tr>
<tr>
<td>None</td>
<td>0</td>
</tr>
<tr>
<td>Physical</td>
<td>1</td>
</tr>
<tr>
<td>Visual</td>
<td>0</td>
</tr>
T:\ftemp>type steve.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"><xsl:variable name="Definitions" select="document('Disab.xml')" />
<xsl:variable name="vP2" select="document('Records.xml')" />
<xsl:key name="options" match="option" use="@type" />
<xsl:key name="records" match="Record" use="disabPrimary" />
<xsl:output indent="yes"/><xsl:template match="/" >
<xsl:for-each select="$Definitions/disabilities/
option[generate-id(.)=generate-id(key('options',@type)[1])
]">
<xsl:sort select="@type"/>
<tr>
<td>
<xsl:value-of select="@type"/>
</td>
<td>
<xsl:variable name="current" select="@oldID"/>
<xsl:for-each select="$vP2">
<xsl:value-of select="count(key('records',$current))"/>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</xsl:template></xsl:stylesheet>
|

Cart



