Enabling the XSLT extension for use in your XSLT templates.
Add the following XML snippet to your ~/config/xsltExtensions.config
file:
<XsltExtensions>
...
<ext assembly="uComponents.XsltExtensions" type="uComponents.XsltExtensions.Random" alias="ucomponents.random" />
...
</XsltExtensions>
Here are available methods in the Random
library:
Gets the random double. Returns: Returns a random dobule.
<xsl:value-of select="ucomponents.random:GetRandomDouble()" />
Gets the random items from CSV. Returns: Returns a random selection of items from the original comma-separated values.
| Name | Type | Notes |
|——|——|——-|
| csv | System.String
| |
| count | System.Int32
| |
<xsl:value-of select="ucomponents.random:GetRandomItemsFromCsv(csv, count)" />
Gets the random GUID. Returns: Returns a random GUID.
<xsl:value-of select="ucomponents.random:GetRandomGuid()" />
Gets the random GUID, with a specified format. Returns: Returns a random GUID, with a specified format.
| Name | Type | Notes |
|——|——|——-|
| format | System.String
| |
<xsl:value-of select="ucomponents.random:GetRandomGuid(format)" />
Gets the random number. Returns: Returns a random integer.
<xsl:value-of select="ucomponents.random:GetRandomNumber()" />
Gets the random number. Returns: Returns a random integer, less than specified maximum.
| Name | Type | Notes |
|——|——|——-|
| maximum | System.Int32
| |
<xsl:value-of select="ucomponents.random:GetRandomNumber(maximum)" />
Gets the random number. Returns: Returns a random integer, between the specified minimum and maximum.
| Name | Type | Notes |
|——|——|——-|
| minimum | System.Int32
| |
| maximum | System.Int32
| |
<xsl:value-of select="ucomponents.random:GetRandomNumber(minimum, maximum)" />
Gets the random numbers. Returns: Returns a sequence of random numbers.
| Name | Type | Notes |
|——|——|——-|
| count | System.Int32
| |
<xsl:value-of select="ucomponents.random:GetRandomNumbers(count)" />
Gets the random numbers as XML. Returns: Returns a sequence of random numbers as an XML node-set.
| Name | Type | Notes |
|——|——|——-|
| count | System.Int32
| |
<xsl:value-of select="ucomponents.random:GetRandomNumbersAsXml(count)" />
Gets the random string. Returns: Returns a sequence of random characters in a string.
| Name | Type | Notes |
|——|——|——-|
| count | System.Int32
| |
<xsl:value-of select="ucomponents.random:GetRandomString(count)" />
Generates the random string. Returns: Returns the specified pattern with characters replaced with random characters.
| Name | Type | Notes |
|——|——|——-|
| pattern | System.String
| |
| replacer | System.String
| |
<xsl:value-of select="ucomponents.random:GenerateRandomString(pattern, replacer)" />