Click here to Skip to main content
16,004,854 members
Home / Discussions / XML / XSL
   

XML / XSL

 
AnswerRe: Encoding UTF-8 vs iso-8859-1 Pin
led mike5-Nov-07 7:22
led mike5-Nov-07 7:22 
AnswerRe: Encoding UTF-8 vs iso-8859-1 Pin
Erik Molenaar5-Nov-07 8:53
Erik Molenaar5-Nov-07 8:53 
GeneralRe: Encoding UTF-8 vs iso-8859-1 Pin
Hariharan21055-Nov-07 16:55
Hariharan21055-Nov-07 16:55 
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 
I am using the SQLXML managed classes to generate some XML from a SQL Server database, specifying a reference to an XSL stylesheet for my SqlXmlCommand object to transform the raw XML returned from the database. My stylesheet is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="Root">
<xsl:element name="ParameterTemplates">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="Root/*">
<xsl:element name="ParameterTemplate">
<xsl:for-each select="@*">
<xsl:element name="Parameter">
<xsl:attribute name="Name"><xsl:value-of select="name()"/></xsl:attribute>
<xsl:attribute name="Value"><xsl:value-of select="."/></xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

I have added the attribute indent="yes" to my <xsl:output> element which has the effect of formatting the output with line feeds. This is fine, however I would like to "prettily" indent the output in a similar manner to that which can be produced using the XmlTextWriter. What is the best way of achieving this? Can I modify my stylesheet to indent the nodes? Or would I have to perform some post-processing of the output in my .NET code to achieve this, perhaps using a combination of an XmlTextReader and XmlTextWriter?

Paul Marfleet

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




-- modified at 18:05 Thursday 1st November, 2007
AnswerRe: &quot;Pretty&quot; indentation of output using SQLXML managed classes? Pin
Stefan Troschuetz1-Nov-07 21:57
Stefan Troschuetz1-Nov-07 21:57 
GeneralRe: &quot;Pretty&quot; indentation of output using SQLXML managed classes? Pin
pmarfleet1-Nov-07 23:50
pmarfleet1-Nov-07 23:50 
GeneralRe: &quot;Pretty&quot; indentation of output using SQLXML managed classes? Pin
pmarfleet2-Nov-07 7:17
pmarfleet2-Nov-07 7:17 
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 

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.