Name

GetPercentileValue

Example

<xsl:call-template name="GetPercentileValue">
  <xsl:with-param name="Rows" select="$Rows"/>
  <xsl:with-param name="ColumnName" select="Age"/>
  <xsl:with-param name="Percentile" select="75"/>
</xsl:call-template>

Code

<xsl:template name="GetPercentileValue">
  <xsl:param name="Rows"/>
  <xsl:param name="ColumnName"/>
  <xsl:param name="Percentile"/>
  <xsl:variable name="Pos" select="ceiling($Percentile div 100 * count($Rows))"/>
  <xsl:for-each select="$Rows">
    <xsl:sort select="@*[name()=$ColumnName]" order="ascending" data-type="number"/>
    <xsl:if test="position() = $Pos">
      <xsl:value-of select="@*[name()=$ColumnName]"/>
    </xsl:if>
  </xsl:for-each>
</xsl:template>

Last edited May 9, 2010 at 4:46 AM by sympmarc, version 2

Comments

No comments yet.