XML : Where is the extra space coming from? (XSLT)

I'm generating hyperlinks with XSLT and I keep getting extra spaces at the end of the linked words.

My XML looks like this:

  The last word needs to be a <url id="1">link</url>.    

The link is concatenated, using the @id. Here's my XSLT:

  <xsl:template match="//url">      <a href="../mainsite.html{@id}"><xsl:copy-of select="."/></a>  </xsl:template>    

For some reason, this generates a link on the word 'link', but it adds a space after it, even though there is no space between the url tags.

If I switch out the xsl:copy-of for a plain string the problem goes away. eg:

  <xsl:template match="//url">      <a href="../mainsite.html{@id}">string</a>  </xsl:template>    

Where on earth is the extra space coming from? It's driving me mad, because any link that's followed by punctuation looks screwy. Where should I be looking at to track down the problem?

Thank you so much to anyone who can help.

No comments:

Post a Comment