在 RSS 查看器 webpart 中生成随机数 [英] generate random number in RSS viewer webpart

查看:19
本文介绍了在 RSS 查看器 webpart 中生成随机数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有以下参考的 RSS 查看器 webpart:

I am using RSS viewer webpart with the following references:

xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"      xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rss1="http://purl.org/rss/1.0/" xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:atom2="http://purl.org/atom/ns#"

谁能建议我如何在 xsl 中生成随机数?

Could anyone please suggest me how to generate random number in xsl ?

我尝试了以下代码:

xsl:value-of select="(floor(math:random()*10) mod 10) + 1"

具有以下参考:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:math="http://exslt.org/math"

以上引用都在抛出错误.请帮忙.

The above references are throwing error. Please help for the same.

推荐答案

如果您的处理器不支持 EXSLT math:random() 函数,那么您可以:

If your processor does not support the EXSLT math:random() function, then you can:

  1. 查看文档以了解处理器是否在不同的命名空间下提供扩展功能;
  2. 使用处理器提供的扩展机制编写自己的扩展函数;
  3. 在运行时向样式表提供一个随机数作为参数;
  4. 从当前日期/时间(如果您的处理器可以生成这些,或者如果您可以在运行时将它们传递给样式表)或其他一些非常量数据(例如已处理文档的长度)派生一个随机数(了解目的在这里会有所帮助);
  5. 从网络服务中获取一个随机数.

这篇关于在 RSS 查看器 webpart 中生成随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆