|
Subject: Re: [xsl] For-each and keys() From: "andrew welch" <andrew.j.welch@xxxxxxxxx> Date: Mon, 31 Jul 2006 17:43:21 +0100 |
Hey group,
Trying to come up with key declarations for the below XML trees (which are both contained within $variables
At the end of the day, I need output that resembles
<output type="Cognitive" count="50" /> <output type="Physical" count="26" /> <output type="Visual" count="34" /> <output type="Hearing" count="90" /> <output type="Mental" count="11" /> <output type="None" count="1" />
The count, in this case, is the amount of times a Record/disabPrimary corresponds to any disabilities/option/@oldID. These must then be grouped by their @type and appear only once in the table.
Sorry to post so much but in trying to score for brevity I have obviously overcorrected and gone straight to muddled ambiguity in previous posts. Please let me know if there is anything too vague that I may elaborate upon. ---
My current XSL has the problem of not using key in a meaningful way (always returns 0) and also produces a row for each Record, although it does order them by type.
XSL goes something like:
<xsl:key name="options" match="option" use="@type" /> <xsl:key name="oldID" match="Record" use="disabPrimary" />
<xsl:variable name="$Definitions" select="Document(Disabilities.xml)" />
<xsl:variable name="$Var" select="Document(Records.xml)" />
<xsl:template match="Record" mode="x">
<xsl:param name="type" />
<tr>
<td>
<xsl:value-of select="$type" />
</td>
<td>
<xsl:variable name="current" select="disabPrimary" />
<xsl:for-each select="$Definitions/disabilities">
<xsl:value-of select="count(key('oldID',$current))" />
</xsl:for-each>
<xsl:for-each select="$Definitions">
<xsl:value-of select="count(key('oldID',$current))" />
</xsl:for-each>You have a few other typo's to fix (if you code matches your example) but that should be it.
cheers andrew
| Current Thread |
|---|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] For-each and keys(), Steve | Thread | Re: [xsl] For-each and keys(), Steve |
| Re: [xsl] Sibling axis and as="elem, David Carlisle | Date | RE: [xsl] Calender support, Michael Kay |
| Month |