Hi,
Another thing you might want to try to strip the space is to use
<xsl:strip-space elements="*"/>
Alice
======================================================
Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
ajwei(_at_)indiana(_dot_)edu
-----Original Message-----
From: Mansour [mailto:mansour77(_at_)yahoo(_dot_)com]
Sent: Thursday, January 24, 2008 11:04 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] How to prevent spaces in the output
That did the trick. Thank you.
I did not now that <xsl:text> will clear the spaces around it.
Thanks a lot.
Abel Braaksma wrote:
Hi Mansour,
This is a FAQ. Use xsl:text when you want to output text. The reason
that you see whitespace is because around the "=" sign, there's
significant whitespace because you created mixed content. Using
xsl:text you avoid this:
<xsl:text>=</xsl:text>
Of course, alternatively you can also remove the significant whitespace.
On a side note: your xsl:for-each is not necessary. If it is the only
instruction in your template, you can remove it completely (it is
redundant) while changing the template match to this:
<xsl:template match="something/@*">
<formatting....
If you left out some code and you do more in the template, you can
also split it:
<xsl:template match="something">
<xsl:apply-templates select="@*" />
... other things on "something"
</xsl:template>
<xsl:template match="something/@*">
<formatting...
</xsl:template>
HTH,
Cheers,
-- Abel Braaksma
Mansour wrote:
Hello every one:
I am facing some difficulties with the spaces in the resulting
output. For example:
<xsl:template match="something" >
<xsl:for-each select="@*">
<formatting:ATTRIBUTENAME>
<xsl:value-of select="concat(' ',name(.))" />
</formatting:ATTRIBUTENAME>
=
<formatting:ATTRIBUTEVALUE>
<xsl:value-of
select="concat('"',.,'"')" />
</formatting:ATTRIBUTEVALUE>
</xsl:for-each>
</xsl:template>
the output is :
<formatting:ATTRIBUTENAME>
attri
</formatting:ATTRIBUTENAME>
=
<formatting:ATTRIBUTEVALUE>
"value"
</formatting:ATTRIBUTEVALUE>
Then when I convert it to html, there are spaces like this: attri =
"value"
How do I avoid this ??
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--