Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - keep whitespace out of my xsl:variables ? [Thread Next] Re: keep whitespace out of my xsl:variables ?To: NULL Date: 6/7/2007 8:56:00 AM * KJ wrote in microsoft.public.xsl: >I have an xsl variable in my XSLT as: > ><xsl:variable name="levelName"> > <xsl:text/> > <xsl:choose> > <xsl:when test="$levelNumber = 3">h3</xsl:when> > <xsl:when test="$levelNumber >= 4">h5</xsl:when> > <xsl:otherwise> > h<xsl:value-of select="$levelNumber+1"/> > </xsl:otherwise> > </xsl:choose> > <xsl:text/> > </xsl:variable> > > >How can I keep the whitespace from being part of a variable's value? You can enclose your text in <xsl:text> element like <xsl:text>h</xsl:text><xsl:value-of ... or you can simply remove the white space from the document <xsl:otherwise>h<xsl:value-of ... It would also be possible to post-process the variable using the XPath normalize-space function, but that is not desirable. -- Björn Höhrmann · mailto:bjoern@h... · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
