[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] position() question


Subject: Re: [xsl] position() question
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 26 Sep 2008 14:49:50 +0100

2008/9/26 Michael Kay <mike@xxxxxxxxxxxx>:
>> The "solution" to the problem is either:
>>
>> a) tell the Microsoft parser not strip the whitespace only text nodes
>>
>> or
>>
>> b) be more explicit in the apply-templates call to only
>> process elements eg <xsl:apply-templates select="*"/>
>
> or (c) tell all processors that you aren't interested in the whitespace by
> using <xsl;strip-space elements="*"/>
>

You have to be a bit careful with (c)

<xsl:strip-space elements="*"/>

because when an element has mixed content such as:

<p> this is <strong>great</strong> <a>click here</a></p>

...the single space between <strong> and the <a> will also get
stripped, giving you this:

"this is greatclick here"

(unless the xml was validated and that element was marked as having
mixed content)


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/


Current Thread
Keywords
xml