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

RE: 2 Questions on message and whitespace

Subject: RE: 2 Questions on message and whitespace
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 25 May 2005 08:56:54 +0100
whitespace not allowed in attribute
> Hi
> 
> I am trying to get rid of &#10 in an attribute
>  T58="&#10;&#10;tt&#10;&#10;  "
> 
> I have tried 
> <xsl:strip-space elements="comments"/>

strip-space has no effect on whitespace characters that are part of the same
node as non-whitespace characters. You haven't shown your source.

> 
> and I am generating this attribute as
> <xsl:attribute name="T58"><xsl:value-of  select="$dnode/comments"
> disable-output-escaping="yes"/></xsl:attribute>


disable-output-escaping is not allowed on xsl:attribute (there have been
drafts of XSLT 2.0 that allowed it, but no longer)

 
> the $dnode is a variable set to the entity that contains
> a comments element.

I don't understand. Entities are not part of the XPath data model, you can't
set a variable to an entity.
> 
> I am not sure why I still get these characters.

So far, you haven't done anything that would remove them.

> 
> Other attempts (that do not work):
> <xsl:attribute name="T58"><xsl:value-of
> select="translate("$dnode/comments",'&#x0A;','')" /></xsl:attribute>

This should work.
> 
> Working version:
> <xsl:variable name="comment"><xsl:value-of
> select="$dnode/comments"/></xsl:variable>
> 
> <xsl:attribute name="T58"><xsl:value-of
> select="translate($comment,'&#x0A;','')" disable-output-escaping="yes"
> /></xsl:attribute>
> 
> I would appreciate why the working-version works.

No idea. There's some information missing.

Michael Kay
http://www.saxonica.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.