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

$variables with xsl:key()

Subject: $variables with xsl:key()
From: Steve <subsume@xxxxxxxxx>
Date: Mon, 24 Jul 2006 13:41:48 -0400
variable in xsl key
The below represents my attempts to create a table which looks something like

Cognitive  --- 26
Hearing    --- 17
*type3*  --- X

X = times which a disability of type=type3 appears in
$vP2/Records/Record as disabPrimary

My understanding of key breaks down somewhere. If you see what I am
doing wrong, please let me know.

Thanks,

-Steve

-------------------------------------------------------
XSL version = 1.0

XSL------------

<xsl:template match="/" >
	<xsl:apply-templates select="document('../../Consumer.xml')/disabilities" />
	<table>
	<xsl:for-each select="document('../../Consumer.xml')/disabilities/option[generate-id(.)=generate-id(key('options',@type)[1])]">
		<xsl:sort select="@type"/>
		<xsl:apply-templates mode="x" select="$vP2/Records">
			<xsl:with-param name="type" select="@type" />
		</xsl:apply-templates>
	</xsl:for-each>
	</table>
</xsl:template>

<xsl:template match="Records" mode="x">
	<xsl:param name="type" />
	<tr>
		<td>
			<xsl:value-of select="$type" />
		</td>
		<td>
			<xsl:value-of select="count(key('oldID',Record))" />
		</td>
	</tr>
</xsl:template>

Variable $vP2 contains via document()-----------

<Records>
   <Record>
         <disabPrimary>101</disabPrimary>
    </Record>
    <Record>
         <disabPrimary>201</disabPrimary>
    </Record>
    <Record>
         <disabPrimary>151</disabPrimary>
    </Record>

.....etc

And consumer.xml disabilties are like----------

<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"/>

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.