white space issue, xhtml output

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

white space issue, xhtml output

Rob Koberg-2
Recently purchased and downloaded Saxon EET01 (haven't received
license yet, but transforms are working without it -- perhaps because
I am still only using the HE features?). I was using an old version of
saxon9he. Since I am starting to do more and more XSL again, decided
to to go with the full EE version for XSLT.

Anyway, I have some source XML like:

<p>What is an <em>expectation</em> <strong>your family has of
you?</strong> (<em>to help with chores</em>)</p>

This content gets passed through an identity transform and is
stripping space so that the result looks like:

<p>What is an <em>expectation</em><strong>your family has of
you?</strong> (<em>to help with chores</em>)</p>

Notice the "</em><strong>". I am using result-document to output
multiple files from the much larger source XML:

<xsl:result-document href="{$base-out-path}{$path}" method="xhtml"
use-character-maps="chars" indent="no">
....

I would have thought that using method="xhtml" would have preserved
the space inside the "p" and between "</em> <strong>"

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

If I add:
<xsl:preserve-space elements="p li td th dt dl span strong b em i big
small tt abbr acronym cite code dfn em kbd strong samp var a bdo br
img map object q script span sub sup button input label select
textarea"/>

the transformation works as expected. But shouldn't an xhtml method
transform do this for me without the need for preserve-space?

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: white space issue, xhtml output

Michael Kay
Your xsl:strip-space instruction causes all whitespace text nodes to be stripped from the input, including those you say you want to retain in the output. The fact that the output method is XHTML doesn't affect what happens to the input.

Michael Kay
Saxonica
[hidden email]
+44 (0) 118 946 5893




On 3 Apr 2015, at 16:42, Rob Koberg <[hidden email]> wrote:

> Recently purchased and downloaded Saxon EET01 (haven't received
> license yet, but transforms are working without it -- perhaps because
> I am still only using the HE features?). I was using an old version of
> saxon9he. Since I am starting to do more and more XSL again, decided
> to to go with the full EE version for XSLT.
>
> Anyway, I have some source XML like:
>
> <p>What is an <em>expectation</em> <strong>your family has of
> you?</strong> (<em>to help with chores</em>)</p>
>
> This content gets passed through an identity transform and is
> stripping space so that the result looks like:
>
> <p>What is an <em>expectation</em><strong>your family has of
> you?</strong> (<em>to help with chores</em>)</p>
>
> Notice the "</em><strong>". I am using result-document to output
> multiple files from the much larger source XML:
>
> <xsl:result-document href="{$base-out-path}{$path}" method="xhtml"
> use-character-maps="chars" indent="no">
> ....
>
> I would have thought that using method="xhtml" would have preserved
> the space inside the "p" and between "</em> <strong>"
>
> I am using:
> <xsl:strip-space elements="*"/>
>
> If I add:
> <xsl:preserve-space elements="p li td th dt dl span strong b em i big
> small tt abbr acronym cite code dfn em kbd strong samp var a bdo br
> img map object q script span sub sup button input label select
> textarea"/>
>
> the transformation works as expected. But shouldn't an xhtml method
> transform do this for me without the need for preserve-space?
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help 


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help