The AS:MinString(NodeList)
function takes a node list as input and returns the node value with the shortest string length.
Syntax:
string MinString(nodeList)
Parameters:
nodeList
: A parameter representing the node list. It should contain a set of XML nodes.
Returns:
- The node value with the shortest string length. If multiple node values have the same shortest length, the function will return the first encountered node value.
NAMESPACE
xmlns:AS="http://schema.advantages.cz/AsapFunctions"
Example Usage:
Input
<ROOT>
<test Name="AAA" />
<test Name="BBBB" />
<test Name="CCCCC" />
</ROOT>
Transformation
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:AS="http://schema.advantages.cz/AsapFunctions"
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="AS date">
<xsl:template match="/ROOT">
<ROOT>
<test test="{AS:MinString(test/@Name)}"/>
</ROOT>
</xsl:template>
</xsl:stylesheet>
Output
<?xml version="1.0" encoding="utf-8"?>
<ROOT>
<test test="AAA" />
</ROOT>