xsl-list
[Top] [All Lists]

AW: Matching text nodes with only whitespaces

2005-02-03 09:04:30
Hi,

I am really sorry for all the troubles, but we had some whitespace issues with 
XML Spy....
First I thought that my normalizing stylesheet doesn't work properly, but 
fortunately it does.
There are interesting things going on, if you decide to "pretty-print" your XML 
documents...

The problem with normalize-space was the following:
We first generated FO documents including nodes like
<marker> §§ 13 </maker>
These documents were pretty printed via XML Spy, so there was whitespace 
which we wanted to get rid off (since it was output in our PDFs).
If we would have used 

<xsl:template match="text()">
        <xsl:value-of select=""normalize-space(.)"/>
</xsl:template>

we would have got 
<marker>§§ 13<marker>

Or is my understanding of normalize-space incorrect?

wbr,
Roman

-----Ursprüngliche Nachricht-----
Von: Andrew Welch [mailto:ajwelch(_at_)piper-group(_dot_)com] 
Gesendet: Donnerstag, 3. Februar 2005 16:46
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: RE: [xsl] Matching text nodes with only whitespaces



I need to write a template matching text nodes, which just 
consit of 
multiple whitespaces (tabs in most cases). I cant't use 
normalize-space since I need leading and tailing 
whitespaces in some 
cases. I suppose matches() would help me here, but I actually don't 
know how to formulate the regular expression for that. Can 
you help me 
here? Thanks!

How about:

<xsl:template match="text()[not(normalize-space(.))]">
 ...
</xsl..

I'm not sure I understand why you can't use normalize-space()?

cheers
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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