xsl-list
[Top] [All Lists]

[xsl] White space strategies for mixed content

2019-11-04 19:00:00
Hi All,

 

I have inherited some "interesting" xml that has mixed content and I am
trying to figure out some strategies for getting "cleaner" output in my XSLT
workflow without removing any needed whitespace. In the simple example
below, I want to normalize the white space and let the serializer write out
the breaks where it wants to.

 

Input:

 

<?xml version="1.0" encoding="UTF-8"?>

<root>

    <para>This is the title element with a

    <emphasis>child</emphasis> element and<strong> another</strong>

    one.</para>

</root>

 

Output:

 

<?xml version="1.0" encoding="UTF-8"?>

<root><para>This is the title element with a <emphasis>child</emphasis>
element and<strong> another</strong> one.</para></root>

 

In this example, I think <xsl:strip-space elements="root"/> would take care
of it with <xsl:output indent="no"/> but of course my actual input is more
complex.

 

I have struggled a bit in my understanding of whitespace handling in XML and
XSLT so I may be missing something obvious. Thanks in advance for any
advice.

 

Rick

 

Rick Quatro

Carmen Publishing Inc.

rick(_at_)frameexpert(_dot_)com

585-729-6746

www.frameexpert.com/store/

 

 
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>