Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSLT: how can proper XML indentation levels be preserved?

Reply
Thread Tools

XSLT: how can proper XML indentation levels be preserved?

 
 
Neil Zanella
Guest
Posts: n/a
 
      07-07-2003
Hello,

I would like to know whether it is possible to get an XSLT processor to output
tags with the proper indentation. For instance, given the following standard
example I get the output given below:

$ cat hello.xml
<?xml version="1.0"?>
<greeting>
Hello, World!
</greeting>

$ cat hello.xsl
<xsl:stylesheet xmlnssl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xslutput method="html" />
<xsl:template match="/">
<xsl:apply-templates select="greeting" />
</xsl:template>
<xsl:template match="greeting">
<html>
<body>
<h1>
<xsl:value-of select="." />
</h1>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

$ xsltproc hello.xsl hello.xml
<html><body><h1>
Hello, World!
</h1></body></html>

.... but this is my first time running an XSLT processor and I was expecting:

<html>
<body>
<h1>
Hello, World!
</h1>
</body>
</html>

Is there anything I can do about this to fix it?

Thanks,

Neil
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove overall indentation preserving reletive indentation Jesse B. Ruby 2 03-27-2010 07:23 PM
multiline strings and proper indentation/alignment John Salerno Python 11 05-10-2006 06:23 PM
XML editor using only indentation for nesting? leap@gol.com XML 1 07-06-2005 12:02 AM
Searching für a big (!) XML document sample with attributes and approx 6 nesting levels Michael Hertz XML 3 09-22-2004 08:47 PM
Searching für a big (!) XML document sample with attributes and approx 6 nesting levels Michael Hertz Java 0 09-19-2004 03:46 PM



Advertisments