Skip to content
Snippets Groups Projects
Commit a69dfd44 authored by uwe's avatar uwe
Browse files

better xpath to identify whitespace text() and intended single-space-between-two-nodes

parent d8b64311
No related branches found
No related tags found
No related merge requests found
...@@ -30,15 +30,13 @@ declare function whitespace:text ...@@ -30,15 +30,13 @@ declare function whitespace:text
( $text as text()*, $escape-char as xs:string? ) as text()* { ( $text as text()*, $escape-char as xs:string? ) as text()* {
let $normalized := normalize-space($text) let $normalized := normalize-space($text)
let $single-whitespace-between-nodes := $text let $whitespace-node := $text[matches(., "[\s\n\r\t]") and normalize-space(.) = ""]
[ self::node() = ' '] let $single-whitespace-between-nodes := $text = ' '
(: [preceding-sibling::node()[not(self::node() = text())]]:)
(: [following-sibling::node()[not(self::node() = text())]]:)
return return
if ( $normalized != "" or $single-whitespace-between-nodes) then ( if ( not($whitespace-node) or $single-whitespace-between-nodes) then (
if ($escape-char) then ( if ($escape-char) then (
whitespace:escape-text($text, $escape-char) whitespace:escape-text($text, "#")
) else ( whitespace:escape-text($text, " ") ) ) else ( whitespace:escape-text($text, " ") )
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment