[oXygen-user] Xpath and Saxon return tabs as text

George Cristian Bina
Tue Sep 9 10:33:00 CDT 2008


Thanks Wendell for the useful feedback!
I would go for not implementing that as an option in oXygen taking into 
account the simple expression that gets the same result.
Philipp, do you think that you need that as an oXygen option or using 
the //text()[normalize-space()] expression is ok for you?

To match better the relevant text nodes you may try something like 
below, matching on the text nodes that although contain only whitespaces 
have siblings that contain some non whitespace text:

//text()[normalize-space() or 
preceding-sibling::text()[normalize-space()] or 
following-sibling::text()[normalize-space()]]

Best Regards,
George
-- 
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Wendell Piez wrote:
> Hi again,
> 
> At 05:48 AM 9/5/2008, you wrote:
>> Until we add the option for stripping whitespace-only nodes in the 
>> evaluation of expressions on the XPath toolbar you can use the 
>> following XPath 2.0 expression which does the stripping:
>>
>> //text()[string-length(translate(., '&#x20;&#x9;&#xD;&#xA;', '')) > 0]
> 
> Or (more succinctly, to similar effect):
> 
> //text()[normalize-space()]
> 
> The problem being that either of these expressions will fail to retrieve 
> all the text here
> 
> <p>Here's a <b>big</b> <i>bad</i> paragraph.</p>
> 
> since the text node between the 'b' and 'i' elements has only whitespace.
> 
> Cheers,
> Wendell
> 
> 
> 
> ======================================================================
> Wendell Piez                            mailto:
> Mulberry Technologies, Inc.                http://www.mulberrytech.com
> 17 West Jefferson Street                    Direct Phone: 301/315-9635
> Suite 207                                          Phone: 301/315-9631
> Rockville, MD  20850                                 Fax: 301/315-8285
> ----------------------------------------------------------------------
>   Mulberry Technologies: A Consultancy Specializing in SGML and XML
> ======================================================================
> 
> _______________________________________________
> oXygen-user mailing list
> 
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user



More information about the oXygen-user mailing list