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

struck with space handling

Subject: struck with space handling
From: subbu@xxxxxxxxxxxx
Date: Thu, 11 Jul 2002 11:53:36 +0100
xslt space handling
Hi,
I have yet another problem sorting out the whitespace issue(i do not know if i 
can really call it as a whitespace issue )
The problem is as follows...
i want the ids to appear one below the other between the quots like.

"3100004"
"3100007"
"80000"
"3100012"
"3000900"
"80001"
So 
I write the XSL code as below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet SYSTEM "D:\xsl-exp\characterEntities\entityref.dtd">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="text" omit-xml-declaration="yes"/>
	<xsl:template match="/">
<!--line 1 -->	<xsl:for-each select="centers/center"> "<xsl:value-of select=" 
@id"/>"
		<xsl:text>&#xa;</xsl:text>
			</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>

In the above code , where line 1 is,
1.If i write the 
"<xsl:value-of select=" @id"/>"
below the for loop ( in the next line of the for-each)
i get the results as ( note the spaces before the id and the extra newline 
after each ID
<----Spaces----

		"3100004"
                             
		"3100007"

		"80000"

		"3100012"

		"3000900"

		"80001"
2. If i write "<xsl:value-of select=" @id"/>" in the same line as the for-each 
and <xsl:text>&#xa;</xsl:text> in the next line,
then i get result as( note that the spaces before id is sorted but there is an 
extra newline )

"3100004"
		
"3100007"
		
"80000"
		
"3100012"
		
"3000900"
		
"80001"

3. If however i write the "<xsl:value-of select=" @id"/>"  and 
<xsl:text>&#xa;</xsl:text> in the same line as xsl:for-each , i get the result 
what i wanted.. eg., if xsl code is 
<xsl:for-each select="schedule/timeslot">"<xsl:value-of 
select="@id"/>"<xsl:text>&#xa;</xsl:text> ( in the same line)
Then the result is as desired.. like below( note that there are no spaces and 
no extra newlines)

"3100004"
"3100007"
"80000"
"3100012"
"3000900"
"80001"

I am not really sure how the XSLT processor outputs the space.I am really 
concerned because output is depending upon the XSL structure..if i use the tidy 
option in xselerator, then it arrainges the loops etc in a proper indented way, 
which will then not get what i want. I am concerned as to how the structure of 
the XSL coding can impact the output?? is there any way to get around this?
Thanks Very Much
Subbu


--------------------------------------------------------------
Sent with "Me-Mail", Boltblue's FREE mobile messaging service.
http://www.boltblue.com


 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.