xsl-list
[Top] [All Lists]

Re: having problem implementing 'strip-space'

2003-01-27 15:23:09
Hello Steve,

your XSL processor seems to be buggy. "Empty" whitespace nodes are stripped by default in XSL (empty means consisting only of whitespace characters: &#9; (Tab), &#10; + &#13; (line feed + carriage return), &#20; (space)). You already use the correct solution with <xsl:text/>.

You can try:

<xsl:attribute name="href">javascript:bigFig('<xsl:value-of select="$imagefilename"/>', '../fig/big/<xsl:value-of select="$imagefilename"/>.jpg', '<xsl:value-of select="$imagefilename"/>');</xsl:attribute>

(in one line without any whitespace character)

or:

<a href="javascript:bigFig('{$imagefilename}', '../fig/big/{$imagefilename}.jpg','{$imagefilename}');"/>

(attribute value templates)

Regards,

Joerg

Wright, Steve wrote:
Hello,
I am not having any luck getting my xslt scripts to remove the whitespace
and carraige returns from my xml upon conversion to html. The main reason I
need to have the space removed is that I have event handler's w/ javascript
in them that are not working due to the carraige returns in the output which
looks like this:
----------------------------------------------------------------------------
--------------------------------
<a href="javascript:bigFig('
                                FIG01-01','../fig/big/
                                FIG01-01.JPG
                        ','
                                FIG01-01');"><img border="0"
src="../fig/thm/
                                FIG01-01.JPG
                        " alt="
                                FIG01-01" name="my
                                FIG01-01"></a>
----------------------------------------------------------------------------
--------------------------------
----------------------------------------------------------------------------
--------------------------------
the xsl looks like this:
----------------------------------------------------------------------------
--------------------------------
                                        <xsl:for-each select="@NUM">
                                                <xsl:variable
name="imagelabel"><xsl:value-of select="../TTL" /></xsl:variable>
                                                <xsl:variable
name="imagefilename"><xsl:value-of select="//CHAP/@NUM" />-<xsl:value-of
select="." /></xsl:variable>
                                                <tr><td valign="top"
class="text">
                                                        <a>
        
<xsl:attribute name="href">
        
<xsl:text>javascript:bigFig('</xsl:text>
        
<xsl:value-of select="$imagefilename" />
        
<xsl:text>','../fig/big/</xsl:text>
        
<xsl:value-of select="$imagefilename" />
        
<xsl:text>.jpg','</xsl:text>
        
<xsl:value-of select="$imagefilename" />
        
<xsl:text>');</xsl:text>
        
</xsl:attribute>

                                                                <img
border="0" width="150">
        
<xsl:attribute name="src">
        
<xsl:text>../fig/thm/</xsl:text>
        
<xsl:value-of select="$imagefilename" />
        
<xsl:text>.jpg</xsl:text>
        
</xsl:attribute>
        
<xsl:attribute name="alt">
        
<xsl:value-of select="$imagefilename" />
        
</xsl:attribute>
        
<xsl:attribute name="name">
        
<xsl:text>my</xsl:text>
        
<xsl:value-of select="$imagefilename" />
        
</xsl:attribute>
                                                                </img>

                                                        </a>
                                                        <br/>
                                                </td></tr>
                                        </xsl:for-each>

----------------------------------------------------------------------------
--------------------------------
----------------------------------------------------------------------------
--------------------------------
I've tried every implementation of: <xsl:strip-space elements="*"/>
imaginable.

I stumbled upon a suggestion to use the 'normalize()' function just recently
in relation to this sort of problem. Does anyone know how it might be
implemented in this scenario?
----------------------------------------------------------------------------
--------------------------------

Thanks in advance,
Steve




****************************************************************************
This email may contain confidential material.
If you were not an intended recipient, please notify the sender and delete all copies.
We may monitor email to and from our network.

****************************************************************************



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





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



<Prev in Thread] Current Thread [Next in Thread>