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

Re: Whitespace question

Subject: Re: Whitespace question
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Tue, 18 Sep 2001 05:29:08 -0700
christopher r madsen
At 04:56 18-09-2001, Ragulf Pickaxe wrote:
Christopher R. Madsen wrote:
(What you need to do is insert the space unless there's a text node already there, which means that there was something other than just space.)


How do you check wether there is a textnode allready? I am not very good at figuring things out at the moment, sorry.

Something like preceding-sibling::node()[1]self::text(), which will be empty if the preceding node doesn't exist or is something other than a text node.


I am in the situation where I have lots of different kinds of parrent nodes before the <code1> node, so I can't use the <xsl:perseve-space="code"/> unless I wish to write this line sixty times with different elements.

You could also do <xsl:preserve-space elements="*"/>.


I need the program to add a space if there is a new node right after, only if there is a space between them:
(I): <One>bla</One> <Two>bla</Two> should keep the space, but
(II): <One>bla</One><Two>bla</Two> should not, and

In order to distinguish these two cases, you *must* preserve spaces. Once the space is stripped, they are identical, and no amount of XSLT wrangling will help.


Your options are (1) xml:space="preserve" in the original XML, (2) xsl:preserve-space in the XSLT, or (3) some switch to MSXML itself before beginning the transformation.

HTH,
Chris
--
Christopher R. Maden, Principal Consultant, HMM Consulting Int'l, Inc.
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
<URL: http://www.hmmci.com/ > <URL: http://crism.maden.org/consulting/ >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.