Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 13th, 2009, 07:45 PM
Authorized User
 
Join Date: Feb 2009
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to add space between elements

Hi,

I'm wondering how to force a space between two elements. The xslt I'm working with is similar to that shown below. What I want to do is add a space between the copyright year and copyright holder. What is the best way to do this? Is it as simple as sticking in an   in there? Is there an attribute I can add to xsl:value-of? Just curious how others would approach this.

Code:
<xsl:value-of select="copyright/year"/>
<xsl:value-of select="copyright/holder"/>

Thanks,
Josh
 
Old February 14th, 2009, 07:52 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

In XSLT 2.0,

<xsl:value-of select="copyright/(year, holder)"/>

will automatically output the two values space-separated.

In 1.0 use

<xsl:text> </xsl:text>
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Xsl: strip-space elements; and 'group-adjacent' ROCXY XSLT 6 July 15th, 2010 08:59 AM
Create XML file - add elements according to range remya1000 XML 5 October 3rd, 2007 02:50 PM
Add Push button or Check Box in outlook add-ins capdevs VS.NET 2002/2003 0 January 7th, 2006 08:51 AM
Add elements to array TSEROOGY Javascript 5 February 22nd, 2004 03:16 PM
space creeping into <td> elements mountainbiker XSLT 3 January 28th, 2004 03:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.