Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: TEXTAREA and XSL

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 5/3/2004 1:01:00 PM

Gadrin77 wrote:

> I noticed when displaying the contents of a CDATA node inside a
> TEXTAREA using
> MSXML and XSL, I get an extra space before the data.
> 
> at first I thought I hadn't "tightened up" the XSL, but then even when
> I did
> this...
> 
> <textarea rows="24" cols="80"><xsl:value-of
> select="/Root/Child/Data"/></textarea>
> 
> I still got a leading whitespace. During testing the data is only the
> string "Unknown."
> 
> Is this common to others?
> 
> I noticed TEXTAREAs are a bit different when using XSL.

You haven't told us which version of MSXML you use and how you transform.
When I try the following ASP page with MSXML 4

<%@ Language="VBScript" %>
<%
Option Explicit
Dim XmlDocument, XslDocument, Loaded
Set XmlDocument = Server.CreateObject("Msxml2.DOMDocument.4.0")
XmlDocument.async = False
Loaded = XmlDocument.load(Server.MapPath("test20040503.xml"))
If Loaded Then
   Set XslDocument = Server.CreateObject("Msxml2.DOMDocument.4.0")
   XslDocument.async = False
   Loaded = XslDocument.load(Server.MapPath("test20040503Xsl.xml"))
   If Loaded Then
     XmlDocument.transformNodeToObject XslDocument, Response
   Else
     Response.Write "Error loading stylesheet.<br>" & VbCrLf
   End If
Else
   Response.Write "Error loading XML file.<br>" & VbCrLf
End If

Set XmlDocument = Nothing
Set XslDocument = Nothing

%>

to transform the following XML

<?xml version="1.0" encoding="UTF-8"?>
<root><![CDATA[Kibology for all.]]></root>

with the following stylesheet that sets the output method to html

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" encoding="UTF-8" />

<xsl:template match="/">
   <html>
     <head>
       <title>textarea test</title>
     </head>
     <body>
       <form action="">
         <textarea rows="5" cols="80"><xsl:value-of select="root" 
/></textarea>
       </form>
     </body>
   </html>
</xsl:template>

</xsl:stylesheet>

I do not get any leading spaces in the textarea, indeed the output of 
the ASP page is the following HTML:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>textarea test</title>
</head>
<body>
<form action=""><textarea rows="5" cols="80">Kibology for 
all.</textarea></form>
</body>
</html>

Maybe you are not using html as your output method??

Even if I change the ASP page to use MSXML 3 (Msxml2.DOMDocument.3.0) I 
don't get any whitespace.



-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/



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