Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 21st, 2007, 10:44 AM
Authorized User
 
Join Date: Feb 2007
Posts: 51
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Thanks. I was indeed using xslt wrong. I had always generated html output in the past and this was the first time I simply needed to perform simple transforms (xml-to-xml) and didn't even know the basics with that. Now I do, it works as advertised simply using element and attribute statements. Thanks!

 
Old September 21st, 2007, 10:56 AM
Registered User
 
Join Date: Sep 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

DOE solved my problem.
Thanks

 
Old September 21st, 2007, 11:20 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you think DOE (disable output escaping - I presume) has solved your problem them you've probably tackled the problem the wrong way. DOE is severely deprecated and not guaranteed to work at all. In the case you outlined above surely <xsl:text>& # 1 0 ;</xsl:text> (without the spaces) would work? If not then there's something odd in your process that's causing a double-escaping of the output.

--

Joe (Microsoft MVP - XML)
 
Old September 21st, 2007, 12:09 PM
Registered User
 
Join Date: Sep 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the heads up.

I've tried 4 different ways (note: all without spaces) with <Data> results following:

1)
<xsl:text>& # 1 0 ;</xsl:text>
<Data ss:Type="String">GROUP1
GROUP2</Data>

2)
<xsl:text>& a m p ; # 1 0 ;</xsl:text>
<Data ss:Type="String">GROUP1&amp;#10;GROUP2</Data>

3)
<xsl:text disable-output-escaping="yes">& # 1 0 ;</xsl:text>
<Data ss:Type="String">GROUP1
GROUP2</Data>

4)
<xsl:text disable-output-escaping="yes">& a m p ; # 1 0;</xsl:text>
<Data ss:Type="String">GROUP1#10;GROUP2</Data>

1 & 3 are resolving to a invisible linefeed in the xml.
2 resolves to & a m p ; # 1 0 ; which is close.
4 is the only one that gives me the visible & # 1 0 ;

I'll need to do more checking to know why I need DOE.

Thanks again.

 
Old September 21st, 2007, 02:34 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I see, well in theory there's no difference between a "real" linefeed and & # 1 0 ; - so using (1) should be fine. I've tested what you described agree with you, when you ask for & # 1 0 ; it outputs a linefeed and a carriage return (& # 1 3 ;). I'll try to find out why. Which transformer are you using?

--

Joe (Microsoft MVP - XML)
 
Old September 21st, 2007, 04:24 PM
Registered User
 
Join Date: Sep 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm using C# .NET 2.0. Maybe that's the reason.


public class Transformer
{
    public static void TransformXml(string xmlSourceFileName, string xmlResultFileName, string xsltFileName)
    {
        XPathDocument doc = new XPathDocument(xmlSourceFileName);
        XPathNavigator nav = ((IXPathNavigable)doc).CreateNavigator();
        XslCompiledTransform compiledTransform = new XslCompiledTransform(true); // true for debugging support
        compiledTransform.Load(xsltFileName);

        FileStream fs = new FileStream(xmlResultFileName, FileMode.Create);
        compiledTransform.Transform(nav, null, fs);
    }
}


 
Old September 21st, 2007, 04:31 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Yes, but Excel is handling the character incorrectly, irrespective of how the XML is produced. It should treat & # 1 0 ; identically to a bona fide line feed. I've posted a support call to the XML development team in Redmond.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
<?javax.xml.transform.disable-output-escaping ?> robbert XSLT 5 January 5th, 2011 07:28 PM
Big challenge here! How to convert char* to char^? samiswt Visual C++ 2005 1 November 30th, 2007 09:09 PM
Invalid conversion from 'char*' to 'char' deuxmio C++ Programming 3 December 8th, 2006 07:56 AM
Escaping Ampersand Entities android66 Visual Basic 2005 Basics 2 February 5th, 2005 04:46 AM
Escaping < and > barnaclebarnes XSLT 4 October 5th, 2004 08:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.