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

Re: text output with some significant white space

Subject: Re: text output with some significant white space
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 19 Apr 2001 19:32:04 +0100
xml text newline
> when do you use method="text"?

when you are writing text not XML.

in text output < comes out as < in XML it comes out as &gt;.

> Doe's this mean <tag>content</tag> causes
> "content" to go to the output?

yes, but it's better not to make element nodes at all if you've
specified text output.

> In my opinion, the method is so
> propped up with defaults up xml/html output it is very difficult to figure 
> out formatting for other purposes

which method is propped up with what?

> Also, it might help getting a better narrative on what <xsl:text/>
> does.

<xsl:text>foo</xsl:text>

puts "foo" into the output, the important point that it does this even
if "foo" is just white space.

<xsl:text/> is a trick which is best not to use if you find it
confusing.


in 

<xsl:tempate match=...>
<xsl:value-of .../>
xyz
<xsl:apply-templates/>
</xsl:template>

then the child nodes of xsl:template are

text (newline)
element (xsl:value-of)
text (newline xyz newline)
element (xsl:apply-templates)
text (newline)

Now white spave nodes are stripped so th eeffective nodes are

element (xsl:value-of)
text (newline xyz newline)
element (xsl:apply-templates)

note that the newline either side of xyz goes to the output.

If instead you do


<xsl:tempate match=...>
<xsl:value-of .../>
<xsl:text>xyz</xsl:text>
<xsl:apply-templates/>
</xsl:template>


or

<xsl:tempate match=...>
<xsl:value-of .../>
<xsl:text/>xyz<xsl:text/>
<xsl:apply-templates/>
</xsl:template>

Then the newlines appear in white space nodes so are stripped.
In the latter case the xsl:text elements are empty so they don't really
output their content but they do cause the newlines to be in their own
text nodes, and so stripped.

David


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

 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.