[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Wrong indentation with javax.xml.transform.Tr
At 2011-09-20 16:29 +0200, you wrote:
On 9/20/2011 1:30 PM, Andrew Welch wrote:That's correct... you will probably want to strip whitespace only text nodes from the input (which is fine provided you don't have any 'mixed content' elements). Why would "pretty print" add its own indentation to something that is already "pretty"? then repeated application, i.e., in -> pp(in) -> pp(pp(in)) etc, should increase indentation but it doesn't: in and pp(in) may be different but after that it's a no-op. Why? Because it is already "pretty" and doesn't need anything more. Clearly I don't have a good mental model of how the transformer works. The *only* guideline in the specifications is that the end result be easier to read. XSLT says nothing about *how* to do indentation, and in fact what XSLT 1 says is: "may output whitespace in addition to the whitespace in the result tree (possibly based on whitespace stripped from either the source document or the stylesheet) in order to indent the result nicely" ... and what XSLT 2 says is: "MAY output whitespace in addition to the whitespace in the instance of the data model in order to indent the result so that a person will find it easier to read" If the transformer did nothing, it would be conformant. And "pretty" (which fits well with the XSLT 1 use of the technical term "nicely") is in the eye of the beholder. I don't think there can be "wrong" indentation in this case, as implied by your subject line. There is no implication in the specification that indentation is a repetitive and cumulative action. I hope this helps. . . . . . . . . . . Ken -- Contact us for world-wide XML consulting and instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|