[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Whitespace problem


Subject: Whitespace problem
From: "Richard Lander" <rlander@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Jun 1999 13:33:56 -0400

 Hello,

I am having quiet a bit of trouble with whitespace. I'd like to capture the
text of a particular element in a javascript array, so that I can retrieve
it from another window, when it is opened. I thought of using the DOM for
this purpose but would like to stick to XSL and Javascript. Anyways, I can't
seem to capture this text since all of the carriage returns in my source are
preserved, which Javascript doesn't like.

My question: How do I force XSL to strip out the carriage returns in the
text of an element? I am using the 1998-12-16 draft, as I want to stay
compatible with IE5.

I've tried:

<xsl:template match='MCOMMENT'>
 <A><xsl:attribute name="href">#</xsl:attribute>
 <xsl:attribute
name="onclick">javascript:alert('<xsl:apply-templates/>');</xsl:attribute>
 <IMG src="&images;mcomment.gif" border="0"/>
 </A>
</xsl:template>

<xsl:strip-space element="MCOMMENT/PARA"/>

<xsl:template match='MCOMMENT/PARA'>
 <xsl:apply-templates/>
</xsl:template>


Note: MCOMMENT only contains PARA elements.

I've also tried adding the following as an attribute in the xsl:stylesheet
element:

default-space="strip"

Still, the output of MCOMMENT/PARA includes preserved carriage-returns. What
gives?

Note: I'm currently using an alert box, as you may see, as opposed to a
proper window, until I can get the whitespace problem fixed.

Thanks,

Richard.


Richard Lander
relander at uwaterloo.ca
http://pdbeam.uwaterloo.ca/~rlander/

Professional XML Authoring
http://www.on-line-learning.com/



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



Current Thread
Keywords