[oXygen-user] Whitespace-only text nodes in XSLT

Wendell Piez
Mon Jun 29 09:51:32 CDT 2015


Dear Jirka and George,

You guys are absolute correct - and I even knew that - unfortunately
as it happens the real-life bug is in processing a separate file ... I
thought I'd duplicated it but I guess I was actually demonstrating a
"feature". :->

Thanks anyhow (I will look back at the offending stylesheet) --

Cheers, Wendell


On Fri, Jun 26, 2015 at 2:41 AM, Jirka Kosek <> wrote:
> On 26.6.2015 5:49, George Bina wrote:
>> I think that is removed by step 3 in
>> http://www.w3.org/TR/xslt20/#stylesheet-stripping
>
> Exactly. One has to keep in mind that rules for whitespace stripping are
> different for input XML documents and for XSLT stylesheets. Usually this
> works in an intuitive way, but once XML data are put inside XSLT
> stylesheet it can produce unexpected behaviour.
>
> In Wendell's case, easy fix would be using xml:space="preserve":
>
> <xsl:variable name="mixed" as="element()">
>     <mixed xml:space="preserve">Here is mixed content, including
>
>       <one>children</one>
>       <two>with nothing</two>
>
>       but whitespace between them.</mixed>
>   </xsl:variable>
>
> Also please note that xml:space can't be put on xsl:variable in this
> case as text node before <mixed> would break type annotation.
>
>                         Jirka
>
> --
> ------------------------------------------------------------------
>   Jirka Kosek      e-mail:       http://xmlguru.cz
> ------------------------------------------------------------------
>      Professional XML and Web consulting and training services
> DocBook/DITA customization, custom XSLT/XSL-FO document processing
> ------------------------------------------------------------------
>  OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
> ------------------------------------------------------------------
>     Bringing you XML Prague conference    http://xmlprague.cz
> ------------------------------------------------------------------
>



-- 
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^


More information about the oXygen-user mailing list