Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Transforming XML to text (and output tab and new line characters

From: "Sergey Dubinet" <sdub@------.---------.--->
To: NULL
Date: 12/7/2005 9:05:00 PM
The problem is not in .Transform() but in the way how you call .Load().
Nost likely you load XSLT to XPathDocument or XmlDocument and it strips all 
white space nodes. To disable WS stripping in XPathDocument you can pass it 
XmlSpace.Preserve as an argulemt.

To verify that WS stripping is the root of the problem add 
xml:space="preserve" attribute into <xsl:text> element.

Sergey

"Buddy Ackerman" <buddy_N0SPAM@b...> wrote in message 
news:%23sEPG8r8FHA.3200@T......
>
>
>
> "swapna guddanti [MSFT]" <swapnag@m...> wrote in message
> news:438207aa$1@n......
>>
>> "Buddy Ackerman" <buddy_N0SPAM@b...> wrote in message
>> news:eQS26H86FHA.3276@T......
>> > Apparently .NET strips these white space characters (MSXML doesn't)
>> > regardless of what the output method is set to.  I'm using
>> > <xsl:text>&#09;</xsl:text> to output a tab character and
>> > <xsl:text>&#13;&#10;</xsl:text> to output a carriage return and line
> feed
>> > but they get stripped at some point.  I'm passing a StringWriter to the
>> > XslTransform.Transform method.  Anyway to get this to actually output
> the
>> > tab and carriage and line feed characters?
>> >
>> >
>>
>>
>> If you include whitespace or carriage return inside <xsl:text> 
>> constructs,
>> this is considered significant whitespace and will not get stripped 
>> unless
>> you have a <xsl:strip-space> in your xslt file.I'm not able to repro this
>> scenario with StringWriter. Could you please provide more details.
>> thanks,
>> swapna
>>
>>
>>
>
>
>
>
>
> What other detail would you like?  I'm tranforming like this:
>
>    StringWriter xsw = new StringWriter();
>
>    m_Transform.Transform(m_DataDocument, null, xsw, null);
>
> It strips my characters everytime and I've tried different xsl:output
> settings to get it to preserve them.  I don not have <xsl:strip-space> in 
> my
> document.
>
>
> Here's the full stylesheet:
>
>
>
>
>        <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
> xmlns:aspdnsf="http://www.aspdotnetstorefront.com">
>            <xsl:output method="text" omit-xml-declaration="yes" 
> indent="no"
> encoding="utf-8"/>
>
>            <xsl:template match="/">
>                <xsl:apply-templates select="root/Products/Product" />
>            </xsl:template>
>
>            <xsl:template match="Product">
>                <xsl:value-of select="SKU" />
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="Manufacturer" />
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="''" />
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="ProductName" />
>                <xsl:if test="VariantName!=''">
>                    <xsl:value-of select="concat(' - ', VariantName)" />
>                </xsl:if>
>                <xsl:text>&#09;</xsl:text>
>                <xsl:choose>
>                    <xsl:when test="FroogleDescription!=''">
>                        <xsl:value-of select="FroogleDescription" />
>                    </xsl:when>
>                    <xsl:when test="ProductFroogleDescription=''">
>                        <xsl:value-of select="ProductFroogleDescription" />
>                    </xsl:when>
>                    <xsl:when test="/root/configs/config/UseDecr='true' and
> VariantDescr!=''">
>                        <xsl:value-of select="VariantDescr" />
>                    </xsl:when>
>                    <xsl:when test="/root/configs/config/UseDecr='true' and
> ProductDescr!=''">
>                        <xsl:value-of select="ProductDescr" />
>                    </xsl:when>
>                </xsl:choose>
>                <xsl:value-of select="price" />
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="/root/System/StoreUrl" 
> />(!ProductLink
> ProductID=&apos;<xsl:value-of select="ProductID"/>'&apos;
> IncludeATag=&apos;false&apos; !)
>                <xsl:text>&#09;</xsl:text>
>                (!ImageUrl Type=&apos;product&apos; ID=&apos;<xsl:value-of
> select="ProductID"/>&apos; Size=&apos;icon&apos; FullUrl=&apos;true&apos; 
> !)
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="'Auto Parts and Accessories'" />
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="'Y'" />
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="'Ships 2-4 days'" />
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="ShippingCharge" />
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="weight" />
>                <xsl:text>&#09;</xsl:text>
>                <xsl:value-of select="'91304'" />
>                <xsl:text>&#13;&#10;</xsl:text>
>            </xsl:template>
>
>        </xsl:stylesheet>
>
> 




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