Hi there,
Inspired by the inputs given by Casey at the Umbraco Gems CG session yesterday I did some testing of the white-space problem I had, and I just wanted to share my findings (although they may not be groundbreaking).
The problem is that if you try to build the content of an xsl:attribute element in this way:
Code: <xsl:attribute name="alt">
id:
<xsl:value-of select="$currentPage/node/@id"/>
</xsl:attribute>
The indentation is shown in the output like this:
Code:alt="
		id: 
		1073"
While this is not critical for alt-attributes is is really annoying if you are trying to build a source-attribute in the same way. This can be fixed in (at least) two ways:
1) Remove all indentation from your xsl:attribute element. While this solves the problem it is also reduces the readability of the code. This was how I used to do it.
2) Wrap all hard-coded text in <xsl:text> tags. The following works like a charm and your precious indentation is preserved.
Code: <xsl:attribute name="alt">
<xsl:text>id: </xsl:text>
<xsl:value-of select="$currentPage/node/@id"/>
</xsl:attribute>
I also tried to solve the problem using the <xsl:strip-space>/<xsl:preserve-space> tags by adding the following as children of the <xsl:stylesheet> element:
Code:<xsl:preserve-space elements="*"/>
<xsl:strip-space elements="xsl:attribute" />
But not matter how I did it I ended up getting an xslt parsing error. Does any of you have some inputs on using these elements?
Anyways - thanks for a couple of interesting days at Codegarden.
Best Regards
Jonas