I have an XML file that looks like
I want to turn it into a nice html table with division across the top,
CrimeType_Code down the side and the counts as the data.
The list of divisions changes from time to time, so I have this in an
external file
I can't get XSL to loop through Divisions.xml and use the code as a
parameter for Data.xml. So far I've got:
and 14 lots of
but it's not working.
I think it's looping through each element in $divLook, saving the
variable, then trying to find "//xml/rs:data/z:row" in the $divLook variable.
Please help.
Thanks.
Ben
----------------------------------------------
Ben O'Hara
Code:
Data.xml
<z:row crime_no='XX/06/1264'
date_ent='2006-02-02T00:00:00'
ho_class='28/3'
division='HD'
beat='8'
CrimeType_Code='4' />
<z:row crime_no='XX/06/1265'
date_ent='2006-02-02T00:00:00'
ho_class='28/3'
division='AA'
beat='2'
CrimeType_Code='3' />
<z:row crime_no='XX/06/1266'
date_ent='2006-02-02T00:00:00'
ho_class='18/9'
division='CA'
beat='11'
CrimeType_Code='1' />
etc.
CrimeType_Code down the side and the counts as the data.
The list of divisions changes from time to time, so I have this in an
external file
Code:
Divisions.xml
<?xml version="1.0" encoding="utf-8" ?>
<divisions>
<division>
<code>AA</code>
<title>Alpha Division</title>
</division>
<division>
<code>AC</code>
<title>Bravo Division</title>
</division>
<division>
<code>CA</code>
<title>Charlie Division</title>
</division>
</divisions>
I can't get XSL to loop through Divisions.xml and use the code as a
parameter for Data.xml. So far I've got:
Code:
<xsl:variable name="divLook"
select="document('Divisions.xml')"/>
<!--store divisions-->
Code:
<td>Other Violence</td>
<xsl:for-each select="$divLook/divisions/division/code">
<xsl:variable name="divF" select="." />
<td><xsl:value-of
select="count(//xml/rs:data/z:row[@CrimeType_Code='2' and
@division=$divF" /></td>
</xsl:for-each>
I think it's looping through each element in $divLook, saving the
variable, then trying to find "//xml/rs:data/z:row" in the $divLook variable.
Please help.
Thanks.
Ben
----------------------------------------------
Ben O'Hara
David W. Fenton said:We could be confused in exactly the same way, but confusion might be like Nulls, and not comparable.