xsl-list
[Top] [All Lists]

Re: [xsl] Whitespace Copied in Element Content Nodes

2008-07-22 01:41:55
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




--~------------------------------------------------------------------
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>
--~--