Re: [xsl] Need to preserve Whitespace in leading/trainling XML using vb.net

Subject: Re: [xsl] Need to preserve Whitespace in leading/trainling XML using vb.net
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Apr 2011 05:20:27 -0400
As Eike suggested, the AxWebBrowser does, in fact, use the same
rendering engine as Internet Explorer, so the output you're seeing is
probably the result of the "default XML stylesheet" included in IE,
which produces the very nice colored rendering of the XML with the
ability to expand and collapse elements.

Since this stylesheet makes some decisions about how to render the
XML, such as collapsing chunks of whitespace, you may find that its
results are not suitable for your application.

If this is the case, as it seems to be for you, then your best bet is
probably to have your stylesheet output an HTML rendering of your XML,
formatted as you like it, rather than the raw XML with just some
adjustments to whitespace.  This will give you the level of control
you require and should not be a terribly difficult task, if your
requirements for how the result looks aren't too fancy.

-Brandon :)


On Fri, Apr 29, 2011 at 2:41 AM, Sen, Sanghamitra
<sanghamitra_sen@xxxxxxx> wrote:
>
> Hi Brandon,
>
> Let me try to explain what I want to achieve.
>
> I am using VS 2003 code in in VB.Net
> I am sending an XML request through vb code. And at the same time user can
see the xml content of my request in AxWebBrowser.
> But what I am facing problem is if the xml node's data contains leading and
trailing spaces then it just ignores spaces when I see the xml.
> I m using XSL ver 1.0 and XSL code is below
>
> <?xml version="1.0"?>
> <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>     version="1.0">
>
>  <xsl:preserve-space elements="notificationNumber"/>
>
>  <xsl:template match="@*|node()">
>   <xsl:copy>
>    <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
>  </xsl:template>
> </xsl:stylesheet>
>
> Here I want to preserve whitespaces of the element "notificationNumber"
> I am using XslTransform class in vb code.
>
> Say node contains Test1234 with spaces like <notificationNumber> Test1234  
 </notificationNumber>
> I want to display the same way when I look into XML in browser.
>
> Pls let me know If you would need any other informations.
>
> Thx,
> Sangha
>
> -----Original Message-----
> From: Brandon Ibach [mailto:brandon.ibach@xxxxxxxxxxxxxxxxxxx]
> Sent: Thursday, April 28, 2011 11:32 PM
> To: xsl-list
> Subject: Re: [xsl] Need to preserve Whitespace in leading/trainling XML
using vb.net
>
> I'm not sure what you're asking.  You don't mention how XSL is involved, so
this may be off-topic for this list.
>
> Perhaps you can tell us how you've tried to solve the problem you're having
and how that solution didn't work.  That should help us understand of what
you're doing and help to pose a more specific question (which is more likely
to get a quick answer).
>
> -Brandon :)
>
>
> On Thu, Apr 28, 2011 at 9:09 AM, Sen, Sanghamitra <sanghamitra_sen@xxxxxxx>
wrote:
>>
>>  Hi,
>>
>>  I have a requirement that xml should be displayed as shown in view
>> source  means the format should be intact . for example some data in
>> element coming as whitespaces. How to display leading/ trailing space
>> in a data in xml?
>>  I am using  MS  vbnet 2003.
>>
>> Thanks for your help in advance,
>>  Sangha
>>
>> This e-mail, including attachments, may include confidential and/or
>> proprietary information, and may be used only by the person or entity
>> to which it is addressed. If the reader of this e-mail is not the
>> intended recipient or his or her authorized agent, the reader is
>> hereby notified that any dissemination, distribution or copying of
>> this e-mail is prohibited. If you have received this e-mail in error,
>> please notify the sender by replying to this message and delete this e-mail
immediately.
>
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity
> to which it is addressed. If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby notified
> that any dissemination, distribution or copying of this e-mail is
> prohibited. If you have received this e-mail in error, please notify the
> sender by replying to this message and delete this e-mail immediately.

Current Thread