[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:attribute introducing a lot of whitespace

Subject: RE: xsl:attribute introducing a lot of whitespace
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 27 Feb 2007 19:32:19 -0000
RE:  xsl:attribute introducing a lot of whitespace
When you want to include literal text in the output, it's always best to
enclose it like this:

<xsl:text>#</xsl:text>

Otherwise any whitespace adjacent to the text is treated as significant.

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Vijay [mailto:rao_vij@xxxxxxxxx] 
> Sent: 27 February 2007 18:49
> To: XslList
> Subject:  xsl:attribute introducing a lot of whitespace
> 
> Hello,
> 
> I am using xsl:attribute to generate href links .Here is my 
> code. The xml is a simple juicers and then multiple juicer 
> with various attributes. I need to create bookmark type links 
> within the same page.
> 
>       <xsl:variable name="namevar" select="name"/>
>          <td>
>           <a>
>            <xsl:attribute name="href">
>             #<xsl:value-of select="translate($namevar,' ','_')"/>_desc
>            </xsl:attribute> 
>            <xsl:attribute name="name">
>             <xsl:value-of select="translate($namevar,' ','_')"/>_cost
>            </xsl:attribute>
>      <xsl:value-of select = "name"/>           
>           </a>
>         </td>
> 
> Here is where the above link would point to
> 
>           <a>
>            <xsl:attribute name="href">
>             #<xsl:value-of select="translate($namevar,' 
> ','_')"/>_cost           
>            </xsl:attribute> 
>            <xsl:attribute name="name">
>             <xsl:value-of select="translate($namevar,' ','_')"/>_desc
>            </xsl:attribute>
>            <xsl:value-of select = "name"/>
>           </a>
> 
> 
> I see that the generated html from the browser produces a lot 
> of whitespace. This is what I see in the generated source and 
> because of the whitespace the links don't work. 
> 
> <td><a href="
>             #OJ_Home_Juicer_desc
>            " name="OJ_Home_Juicer_cost
>            ">OJ Home Juicer</a></td>
> <td>
> 
> When I strip the white space and bring it in one line in the 
> html and then open and click the links it works fine.
> 
> How can I make this work?
> 
> Thanks in advance
> VJ
> 
> 
>  
> ______________________________________________________________
> ______________________
> Yahoo! Music Unlimited
> Access over 1 million songs.
> http://music.yahoo.com/unlimited

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.