This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

struck with 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]