Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple problem - spaces (xsl) 1

Status
Not open for further replies.

Delameko

Programmer
Oct 14, 2003
37
GB
I have an address in the XML thats divided into parts.

In the XSL I'm displaying it like so:

Code:
<xsl:value-of select="streetNumber" /><xsl:text>&#160;</xsl:text>
<xsl:value-of select="streetName" />,<br />
<xsl:value-of sel... etc etc


The problem is that not all entries have a streetNumber value, but the &#160 is always going to add a space before the streetName (making the presentation look a bit iffy on some of the pages).

Anyone got any solutions?
 
Code:
<xsl:if test="string-length(streetNumber)">
  <xsl:value-of select="streetNumber" />
  <xsl:text>&#160;</xsl:text>
</xsl:if>

Jon

"I don't regret this, but I both rue and lament it.
 
hehe, thanks Jon. I hadn't even considered an if statement :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top