Greg--
At 05:21 PM 6/11/2002, you wrote:
I need to remove newlines from the <o><o/> element in the
following XML:
<Synopsis>
<c>mmerge</c> <o>[-n] [-to <var>tag</var>|<var>rev</var>]
[-from <var>tag</var>|<var>rev</var>] [-v[<var>N</var>]] [-mytag]
[-noeditor] [mput_options] <var>file</var>...</o>
<c>mmerge</c> <o>[-n] [-to <var>tag</var>|<var>rev</var>]
[-v[<var>N</var>]] [-noeditor] [mput_options]
-j <var>job@cluster</var> [...]</o>
</Synopsis>
My XSLT has a strip-space declaration for all of the Synopsis element,
which I'm assuming covers child elements too?
Nope; strip-space only goes one level down.
What you're discovering about how tough it is to strip newlines from the
<o> elements is par for the course, if you need to keep descending (which
you do).
The solution is to do your space normalizing only when you get to the bottom:
<xsl:template match="text()">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
You can constrain this to match="o/text()" or o//text() if needed.
If you don't want to compress runs of spaces, use the translate() function
on LF characters, as you tried, but again at that bottom level.
I hope that helps,
Wendell
======================================================================
Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|