xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Newline problems


Subject: Re: [xsl] Newline problems
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 1 May 2003 18:46:59 -0600 (MDT)

Vishwajit Pantvaidya wrote:
> Since I have no way of knowing which elements in the source xml would have 
> newlines, would it mean that I will need to have the normalize-space 
> function all over my xsl sheet?

Not necessarily. Whereas you might be used to doing things like
<xsl:value-of select="/path/to/some/element"/>
and are shuddering at the thought of changing this to
<xsl:value-of select="normalize-space(/path/to/some/element)"/>,
you could utilize the power of XSLT a bit more and do so-called
"push" processing like
<xsl:apply-templates select="/path/to/some/element"/> and have
the template that matches that type of element do
<xsl:apply-templates select="text()"/>
or you could go straight to the text node itself like
<xsl:apply-templates select="/path/to/some/element/text()"/>
.. in either case you could then override the
built-in template for text nodes by making it do normalize-space()
instead of <xsl:copy/>.

<xsl:template match="text()">
  <xsl:value-of select="normalize-space(.)"/>
</xsl:template>

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



Current Thread
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor