Description
The functx:max-line-length function counts the number of characters in each line, and returns the maximum. It uses carriage return and/or newline characters to determine the end of a line. It is useful for determining the amount of space a fixed-format string will take up on, for example, a web page.
Arguments and Return Type| Name | Type | Description |
$arg |
xs:string? |
the string to test |
| return value |
xs:integer |
XSLT Function Declaration| See XQuery definition. | | XSLT 2.0 Syntax: |
|---|
<xsl:function name="functx:max-line-length" as="xs:integer"
xmlns:functx="http://www.functx.com" >
<xsl:param name="arg" as="xs:string?"/>
<xsl:sequence select="
max(
for $line in functx:lines($arg)
return string-length($line))
"/>
</xsl:function>
|
Examples<xsl:variable name="lines" as="item()*"> | | 'a
value
on several
lines' |
| </xsl:variable> |
| XSLT Example | Results |
|---|
functx:max-line-length('a value')
|
7
|
functx:max-line-length($lines)
|
10
|
Depends OnSee AlsoHistory |
|