<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:math="http://exslt.org/math">
  <xsl:import href="http://powertoys.public/Style%20Library/XSL%20Style%20Sheets/math.random.xsl" />
  <xsl:output method="html" indent="no" />
  <xsl:variable name="parent" select="/items/item" />
  <xsl:variable name="count" select="count($parent)+1" />
  <xsl:variable name="random" select="math:random(1, $count, 1)"/>
  <xsl:template match="/">
    <xsl:for-each select="$parent">
      <xsl:if test="position()=$random">
        <xsl:value-of select="." />
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

Last edited Jun 27, 2008 at 10:25 PM by davidlwalker, version 1

Comments

No comments yet.