Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Newbie Question >Thread Next - Re: Newbie Question Re: Newbie QuestionTo: NULL Date: 7/1/2008 3:45:00 PM "Joseph J. Kesselman" <keshlam-nospam@c...> wrote in message news:486a8599$1@kcnews01... > rhino wrote: >> <p><xsl:value-of select="firstname"/><xsl:value-of >> select="lastname"/></p> >> So, how do I get a blank space to appear between firstname and lastname? > > The most straightforward solution is: > > <p><xsl:value-of select="firstname"/><xsl:text> </xsl:text><xsl:value-of > select="lastname"/></p> > > This is necessary because whitespace in stylesheets is normally discarded > unless it's next to non-whitespace text. Wrapping the literal whitespace > in <xsl:text> tells the processor "I really want this to be output exactly > as it appears here." > > There are other ways to do it, of course -- anything that generates a > whitespace value will accomplish the task -- but this is the one that will > make the stylesheet easiest for a human to read. > > FWIW, we've seen a number of cases where the tutorials at w3schools have > been ... well, let's be charitable and say "incomplete". They may have > improved since then, but you might want to consider looking at other > sources as well or instead. My standard recommendation is the > DeveloperWorks XML site, http://www.ibm.com/xml, but I admit to being > biased. Thank you, Joseph! I was just going to post back to say that I'd figured out my problem via a Google search; I used the following and it worked fine: <li><xsl:value-of select="firstname"/> <xsl:value-of select="lastname"/></li> I tried your way and it worked fine, too. I also tried putting multiple spaces within the <xsl:text> </xsl:text> block and was surprised that only one space was displayed no matter how many I put there. If I ever need to put multiple spaces somewhere, I may do it with character entitites; it would be easier (or at least use less space) to do   five times than to do <xsl:text> </xsl:text> five times! But there's probably a better way than that which I just haven't learned yet ;-) I agree that the w3schools tutorials are not the best. I've used them with some success in the past simply to get a few basics under my belt, then moved on to better tutorials, references, or books as I got the basics sorted out. The w3schools tutorials are pretty superficial and really only give you a few basic concepts and tutorials and I don't find them particularly thorough either. I appreciate your suggestion about a better source of information. I'll have a look at the IBM XML site in a minute. Thanks for your help and your time! -- Rhino | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
