Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Passing distinct values as parameters Passing distinct values as parametersTo: NULL Date: 11/16/2007 5:27:00 PM I would like to search an XML document for a set of distinct values,
then process the document based on those values. I have been able to
get this to work by hardcoding a set of string and passing them along.
Hard coded string example:
<xsl:call-template name="writeTotal">
<xsl:with-param name="location">Florida</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="writeTotal">
<xsl:with-param name="location">Washington</xsl:with-
param>
</xsl:call-template>
<xsl:call-template name="writeTotal">
<xsl:with-param name="location">Total</xsl:with-param>
</xsl:call-template>
<xsl:template name="writeCount">
<xsl:param name="location"/>
<xsl:variable name="locationNodes"
select="descendant::PERSON[LOCATION=$location]"/>
<!-- do something with nodes for this location -->
</xsl:template>
But I would like to automate this to pull the list directly from the
incoming XML. When I use the following, I am getting a list of
distinct nodes, but I am unable to make the comparison work:
<xsl:for-each select="//LOCATION[generate-id()=generate-
id(key('distinct-segcode',.))]">
<xsl:call-template name="writeCount">
<xsl:with-param name="location"><xsl:value-of select="."/
></xsl:with-param>
</xsl:call-template>
</xsl:for-each>
<xsl:template name="writeCount">
<xsl:param name="location"/>
<xsl:variable name="locationNodes"
select="descendant::PERSON[LOCATION=$location]"/>
<!-- do something with nodes for this location -->
</xsl:template>
My location nodes appears to be empty - ie: it's not matching the
incoming value of location to anything. I've tried various
combinations of normalize-space to no avail.
Any ideas?
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
