Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Newbie Question

From: "rhino" <No.offline.contact.please@---------.--->
To: 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"/>&#32;<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 &#32; 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




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent