Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - using xsl variables in count() >Thread Next - Re: using xsl variables in count() Re: using xsl variables in count()To: NULL Date: 3/3/2005 4:18:00 PM "Ryan" <rlhuff@g...> wrote in message
news:1109865757.834461.227040@f......
> Hello. I'm trying to develop a dynamic report that will display
> specific statistics about a given data set. The simplest example is
> included below.
>
> I'm iterating through the set and displaying the unique values of a
> particular element (in the first column). Then, in the second column
> I'm showing just a percentage of those values over the entire set
> (part/whole %). The challenge is that I'm running into problems on this
> line:
> count(/dsQueryResponse/Rows/Row[normalize-space(@Status) =
> '$uniqueStatus']/@ID)
>
> It seems that "$uniqueStatus" is evaluated as a string -- not a
> variable.
>
> The question is, how do I access the value of the variable from here?
>
> Another note... @Status has the same value as $uniqueStatus here. I
> need to access one or the other.
>
> I don't know if it's relevant, but this is from a SharePoint (WSS)
> list.
>
> Thanks!
>
> <xsl:template name="dvt_1.footer">
> <xsl:param name="Rows"/>
> <table cellSpacing="0" cellPadding="4" border="0" width="100%">
> <tr>
> <td class="ms-vb"><b>Test Status</b></td>
> <td class="ms-vb"><b>% Overall</b></td>
> </tr>
> <xsl:for-each select="$Rows">
> <xsl:variable name="uniqueStatus" select="@Status"/>
> <xsl:if
> test="generate-id()=generate-id(//Rows/Row[@Status=$uniqueStatus][1])">
> <TR>
> <TD Class="{$IDAPHEDF}">
> <xsl:value-of disable-output-escaping="no"
> select="@Status"/>
> </TD>
> <TD Class="{$IDAPHEDF}">
> <xsl:value-of
> select="count(/dsQueryResponse/Rows/Row[normalize-space(@Status) =
> '$uniqueStatus']/@ID)"/>
> {<xsl:value-of select="$uniqueStatus" />} <!-- just for
> display purposes -->
> </TD>
> </TR>
> </xsl:if>
> </xsl:for-each>
> </table>
> </xsl:template>
>
You should remove the quotation marks:
count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = $uniqueStatus]/@ID)
--
Joe (MVP - XML)
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
