Re: White space in HTML result??
> <a> > [...] > </a>   > </xsl:for-each> > > The problem is, after each </a> in the HTML page, there is x number of > spaces. Well this is expected, because after the 'a' element you have 2 non-whitespace characters and then a newline which is whitespace and some spaces or tabs, which are also whitespace. Yes, I know non-breaking spaces look like whitespace, but they aren't really. The XPath/XSLT tree model insists that all adjacent text becomes one text node, so you've got a text node containing all that text, starting with the 2 non-breaking spaces. The model says that if the text node is nothing but whitespace, it might be removed from the tree ('stripped') prior to processing. If it's in the stylesheet it will always be stripped and you have no control over this. If it's in the source tree, you have some control that I won't go into here.. But this is academic since your text node is not purely whitespace. This means you are stuck with it! You just need to get the non-breaking spaces into a text node by themselves. This will do it: <xsl:for-each ...> <a> [...] </a> <xsl:text>  </xsl:text> </xsl:for-each> Just be aware that it's not the fact that <xsl:text> is being used; it's the fact that the non-breaking spaces are contained inside *some* element, separate from the whitespace that comes at the end of the contents of the xsl:for-each element. - Mike ____________________________________________________________________ Mike J. Brown, software engineer at My XML/XSL resources: webb.net in Denver, Colorado, USA http://skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format