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

best practices for preserving spaces in mixed content

Subject: best practices for preserving spaces in mixed content when making XML to XML
From: Dorothy Hoskins <dorothy.hoskins@xxxxxxxxx>
Date: Fri, 6 Sep 2013 12:32:32 -0400
 best practices for preserving spaces in mixed content
HI, I would like advice on the following situation:
I am copying the majority of one XML to another XML but I want to
insert some label text into some elements.
Beginning XML:
<note type="warning"><para>This is <b>mixed content</b> text for a
specific purpose.para></note>

Final XML could be this:
<note type="warning"><para><label>label text: </label>This is <b>mixed
content</b> text for a specific purpose.</para></note>

or it could be this:
<note type="warning"><label>label text: </label><para>This is <b>mixed
content</b> text for a specific purpose.</para></note>
The <label> will have distinctive output formatting.

My questions:
1) Which output is generally preferable, when <para> is a block
element - <label> before <para> or <label> inside <para>? Since <para>
is a block element, it seems that it would be better to put the
<label> inside the <para> rather than before it, within the <note>.

2) Assuming that I might want to make changes within the <para> also,
what is the best method to preserve the spaces around inline elements
such as <b>? For example, if there is an inline <image> in the <para>,
I might want to change its @href>, but probably I would simply copy
the <b>. If there aren't any inlines, I could just copy the <para>
without further processing, but I've had a problem retaining the
spaces around inlines when using apply-templates.

3) Is it better practice to insert the punctuation (colon and space)
after generated label text as part of the <label> content, or to
output them as text literals after the <label>? For example, I can
generate the text of the label inside the <label> element, followed by
<xsl:text>: </xsl:text> or use some other method such as a variable to
externalize the following punctuation and pull that variable value in
with logic, so that the punctuation could be different for different
languages.

Thanks, Dorothy

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.