xsl-list
[Top] [All Lists]

[xsl] Why does the tokenize() function behave strangely when I use ENTITIES and variables?

2016-04-07 08:40:19
Hi Folks,

I have a stylesheet which reads a text file and tokenizes it. The token 
delimiter is two consecutive newline characters (hex 0A, hex 0A).

If I use the tokenize() function like this:

        tokenize($text-file, '

')

then the text file is correctly tokenized.

But if I create an entity:

<!DOCTYPE xsl:stylesheet [
    <!ENTITY line-separator     '&#x0A;'>
]>

and a variable whose value is two line-separators:

<xsl:variable name="rule-separator" 
select="'&line-separator;&line-separator;'"/>

and then use the variable with the tokenize() function:

        tokenize($text-file, $rule-separator)

then the text file is not tokenized correctly. Specifically, the XSLT processor 
uses two consecutive space characters (hex 20, hex 20) as the token delimiter 
rather than two consecutive newline characters (hex 0A, hex 0A) as the token 
delimiter.

Do you know why this is happening? How do I fix it?

/Roger
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>