[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Whitespace Copied in Element Content Nodes

Subject: Re: Whitespace Copied in Element Content Nodes
From: "Abel Braaksma (online)" <abel.online@xxxxxxxxx>
Date: Tue, 22 Jul 2008 10:41:31 +0200 (CEST)
Re:  Whitespace Copied in Element Content Nodes
Hi Jeff,

I don't think it would matter whether you use Saxon SA or B for it (it is
ignorable whitespace, not illegal whitespace).

However, what does matter is how your identity transform is defined. If you
have a "catch all" (match="node() | @*") then text nodes, whether relevant or
not, will be matched by your identity template and, depending on your
instructions inside your matching template, copied.

Do you already use an xsl:strip-space declaration?

Maybe this part of the spec is your culprit, so I include it here for reference:

"If an element in a source document has a type annotation  that is a simple
type or a complex type with simple content, then any whitespace text nodes
among its children are preserved, regardless of any xsl:strip-space 
declarations."
(http://www.w3.org/TR/xslt20/#element-strip-space)

If all fails, you can add something like this to your stylesheet:

<xsl:template match="text()
            [normalize-space() = '']
            [parent::*/*]" />

which will remove any whitespace nodes that are not whitespace-only nodes.

Cheers,
-- Abel --


> Hi,
>
> I'm doing a identity transformation of an XML that is defined in a
> XML Schema, why is it that my element defined as element only content
> retains the whitespace used for indention in the result? I expected
> that this would be removed because these are ignorable whitespace as
> defined in the schema.
>
> I'm using XSLT 2.0 and transforming using oXygen and Saxon 9B.
>
> Do I need a SA  version of Saxon for this?
>
> Thanks,
> -- Jeff
>
> Jeferson L. Sese
> jeferson dot sese at asiatype dot com
> Asiatype Inc.
> Suite 114 Columbia Tower
> Ortigas Ave., Greenhills
> Mandaluyong City 1550 Philippines
> Tel: +632-744-6262
> Mobile: +63927-671-7901

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.