Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Passing distinct values as parameters

From: davidcl64@-----.---
To: 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?


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent