home contribute faq download

FunctX XSLT Functions

functx:line-count

The number of lines

Google
Webxsltfunctions.com

Description

The functx:line-count function counts the number of lines in a string, using the carriage return and newline characters to indicate the end of a line.

Arguments and Return Type

NameTypeDescription
$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:line-count" as="xs:integer" 
              xmlns:functx="http://www.functx.com" >
  <xsl:param name="arg" as="xs:string?"/> 
 
  <xsl:sequence select=" 
   count(functx:lines($arg))
 "/>
   
</xsl:function>

Examples

<xsl:variable name="lines" as="item()*">
'a
value
on
many
lines'
</xsl:variable>
XSLT ExampleResults
functx:line-count('a value')
1
functx:line-count($lines)
5

Depends On

functx:linesSplit a string into separate lines

See Also

functx:word-countThe number of words
functx:max-line-lengthThe maximum line length

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Need XSLT Help?
D A T Y P I C
Training | Consulting | Development

XQuery by Priscilla WalmsleyGet the book!
XQuery by Priscilla Walmsley