Re: [xsl] copy-of select in textaereas

Subject: Re: [xsl] copy-of select in textaereas
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 2 Dec 2002 17:36:50 GMT
  this doesn't work at all:
  <textarea name="{@name}" onChange="{@onchange}" onclick="{@onclick}"
  rows="4" cols="10"><xsl:copy-of select="@value"/></textarea>

well the xslt should work and copy the value attribute to make a value
attribute in the result, but that isn't what you want.

  this works fine without carriage returns:
  <textarea name="{@name}" onChange="{@onchange}" onclick="{@onclick}"
  rows="4" cols="10"><xsl:value-of select="@value"/></textarea>

It is not XSLT that is losing the lines it is the XML parser.
XML specifies that
<a x="a
b
c">
is the same input as 
<a x="a b c">
so _every_ XML application, including XSLT will see spaces not line ends
in an attribute value.

If you must use an attribute in your source and line ends matter you
have to do
<a x="a&#10;b&#10;c">
which is the XML encoding of an attribute with value
"a
b
c"

Or change your input format so the value is stored in an element not in
an attribute.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread