math random function in xslt sp2010 designer?

Hi 

 How to pass a variable name inside sp2010  xslt  Random function ?is there a way to do it?

eg : ddwrt:random($no of questions)? 

thanks in a

July 9th, 2013 10:38pm

Hi,

From your description, I understand that you want to pass a variable to a function in xslt.

In this condition, you can use the xsl function definition consisted by "function name", "param name" and "value-of".

I think below code will suit for you:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ns1="http://www.example.com">


    <xsl:function name="ns1:functionName">
    	<xsl:param name="employee_name"/>
    	<xsl:value-of select="$employee_name"/>
    </xsl:function>

    <xsl:template match="/">
    	<xsl:value-of select="ns1:functionName('John Doe')"/>
    </xsl:template>
</xsl:stylesheet>

Free Windows Admin Tool Kit Click here and download it now
July 10th, 2013 5:57am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics