Click here to Skip to main content
15,892,005 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Encoding UTF-8 vs iso-8859-1 Pin
Erik Molenaar5-Nov-07 22:53
Erik Molenaar5-Nov-07 22:53 
GeneralRe: Encoding UTF-8 vs iso-8859-1 Pin
Hariharan21055-Nov-07 23:06
Hariharan21055-Nov-07 23:06 
GeneralRe: Encoding UTF-8 vs iso-8859-1 Pin
Erik Molenaar5-Nov-07 23:17
Erik Molenaar5-Nov-07 23:17 
AnswerRe: Encoding UTF-8 vs iso-8859-1 Pin
George L. Jackson5-Nov-07 14:49
George L. Jackson5-Nov-07 14:49 
Question"Pretty" indentation of output using SQLXML managed classes? Pin
pmarfleet1-Nov-07 11:41
pmarfleet1-Nov-07 11:41 
AnswerRe: "Pretty" indentation of output using SQLXML managed classes? Pin
Stefan Troschuetz1-Nov-07 21:57
Stefan Troschuetz1-Nov-07 21:57 
GeneralRe: "Pretty" indentation of output using SQLXML managed classes? Pin
pmarfleet1-Nov-07 23:50
pmarfleet1-Nov-07 23:50 
GeneralRe: "Pretty" indentation of output using SQLXML managed classes? Pin
pmarfleet2-Nov-07 7:17
pmarfleet2-Nov-07 7:17 
I found the answer to my problem. If I perform the transform using the .NET framework classes instead of the SQLXML managed classes, I can use the XmlTextWriter to control the indentation.

public static string ExecuteQueryAndTransform(string connectionString, string queryText, string xslPath)
        {
            string result = String.Empty;
            SqlXmlCommand cmd = new SqlXmlCommand(connectionString);
            
            if (!queryText.EndsWith("For XML Auto", StringComparison.CurrentCultureIgnoreCase))
            {
                queryText += " For XML Auto";
            }            
            cmd.RootTag = "Root";
            cmd.CommandText = queryText;
            
            using (Stream strm = cmd.ExecuteStream())
            {
                XmlTextReader reader = new XmlTextReader(strm);
                XPathDocument xd = new XPathDocument(reader, XmlSpace.Preserve);
                XslCompiledTransform xslt = new XslCompiledTransform();
                xslt.Load(xslPath);
                StringWriter stringWriter = new StringWriter();
                XmlTextWriter writer = new XmlTextWriter(stringWriter);
                writer.Formatting = Formatting.Indented;
                writer.Indentation = 3;
                writer.IndentChar = ' ';
                xslt.Transform(xd, null, writer);
                result = stringWriter.ToString();
            }
     }


Thanks for your help anyway.

Paul Marfleet

"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush


QuestionHow to insert Comma between templates Pin
Sushant_Mathur28-Oct-07 23:29
Sushant_Mathur28-Oct-07 23:29 
AnswerRe: How to insert Comma between templates Pin
George L. Jackson29-Oct-07 1:45
George L. Jackson29-Oct-07 1:45 
GeneralRe: How to insert Comma between templates Pin
Sushant_Mathur29-Oct-07 2:41
Sushant_Mathur29-Oct-07 2:41 
GeneralRe: How to insert Comma between templates Pin
George L. Jackson29-Oct-07 3:00
George L. Jackson29-Oct-07 3:00 
GeneralRe: How to insert Comma between templates Pin
George L. Jackson29-Oct-07 3:39
George L. Jackson29-Oct-07 3:39 
GeneralRe: How to insert Comma between templates Pin
Sushant_Mathur29-Oct-07 3:48
Sushant_Mathur29-Oct-07 3:48 
QuestionProblem recognizing charcter entities Pin
Zoltan Aszalos28-Oct-07 21:41
Zoltan Aszalos28-Oct-07 21:41 
AnswerRe: Problem recognizing charcter entities Pin
George L. Jackson29-Oct-07 3:06
George L. Jackson29-Oct-07 3:06 
GeneralRe: Problem recognizing charcter entities Pin
Zoltan Aszalos29-Oct-07 4:22
Zoltan Aszalos29-Oct-07 4:22 
QuestionConvert MS Excel file to XML file Pin
sonigirish28-Oct-07 18:56
sonigirish28-Oct-07 18:56 
AnswerRe: Convert MS Excel file to XML file Pin
Paul Conrad4-Nov-07 7:58
professionalPaul Conrad4-Nov-07 7:58 
Questiongetting element [modified] Pin
RussBus25-Oct-07 12:30
RussBus25-Oct-07 12:30 
AnswerRe: getting element Pin
George L. Jackson25-Oct-07 13:15
George L. Jackson25-Oct-07 13:15 
GeneralRe: getting element Pin
RussBus26-Oct-07 4:32
RussBus26-Oct-07 4:32 
AnswerRe: getting element Pin
pmarfleet26-Oct-07 7:48
pmarfleet26-Oct-07 7:48 
GeneralRe: getting element Pin
RussBus26-Oct-07 7:54
RussBus26-Oct-07 7:54 
AnswerRe: getting element Pin
George L. Jackson26-Oct-07 9:30
George L. Jackson26-Oct-07 9:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.