[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: Florent Georges <darkman_spam@xxxxxxxx>
Date: Tue, 27 Feb 2007 20:55:13 +0100 (CET)
Re:  xsl:attribute introducing a lot of whitespace
Vijay wrote:

  Hi

>     <xsl:attribute name="href">
>      #<xsl:value-of select="translate($namevar,' ','_')"/>_cost      
    
>     </xsl:attribute>

  When the stylesheet is compiled, the only-whitespace-nodes
(and only them) are ignored.  In your above example, the
xsl:attribute has three children: 1/ one text node starting
with a newline then spaces then a '#', 2/ the xsl:value-of
element and 3/ a text node starting with '_cost' then a
newline then spaces.

  Because they are not only-whitespaces-text-nodes, the text
nodes are not ignored by the XSLT processor.  You have to
solutions: 1/ correct the text nodes in your stylesheet or
2/ use xsl:text:

    <xsl:attribute name="href">#<xsl:value-of
select="translate($namevar,' ','_')"/>_cost</xsl:attribute>

    <xsl:attribute name="href">
      <xsl:text>#</xsl:text>
      <xsl:value-of select="translate($namevar,' ','_')"/>
      <xsl:text>_cost</xsl:text>
    </xsl:attribute>

  The use of xsl:text let you keep a correctly indented
code.  Personnally, I *always* use xsl:text when I want to
generate a text node (except maybe in literal elements).
That helps to avoid such errors.

  Regards,

--drkm



















	

	
		
___________________________________________________________________________ 
Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions ! 
Profitez des connaissances, des opinions et des expiriences des internautes sur Yahoo! Questions/Riponses 
http://fr.answers.yahoo.com

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.