Project

Profile

Help

Saxon is indenting my attributes

Added by Anonymous almost 15 years ago

Legacy ID: #7464239 Legacy Poster: MetinH (metinh)

Hello everyone. I'm having a problem with saxon indenting my attributes when transforming a document using XSLT. I'm using Java 6 and the Saxon 9 jars. Exhibited behavior: <oa:ItemID xmlns:oa="http://www.blah/9" agencyRole="Number"> <oa:ID>T6570</oa:ID> </oa:ItemID> Desired Behavior: <oa:ItemID xmlns:oa="http://www.blah/9" agencyRole="Number"> <oa:ID>T6570</oa:ID> </oa:ItemID> I would like the opening tag to be on one line. Furthermore, the indenting is done using spaces and not tabs. All these spaces are bytes which, in turn, significantly bump up the size of my output xml file by roughly 20%. Normally, this would not be a big deal, however my output xml file is about 1 GB. When I run the same xslt through XML Spy, I don't have this problem. Does anyone have any suggestions on how to fix this? Thanks in advance for your help!


Replies (1)

RE: Saxon is indenting my attributes - Added by Anonymous almost 15 years ago

Legacy ID: #7464390 Legacy Poster: Michael Kay (mhkay)

If you're worried about file size, don't use indenting. Indenting is only useful for files intended for a human reader. I find it hard to imagine a 1Gb output file being intended for a human reader. The reason attributes are indented like this is because it's not uncommon for an element to have 10 namespace declarations each about 60 characters long, and it's very hard to read a document containing a single line of 600 characters. The whole purpose of indent=yes is to make it easier for human readers to read the document. The reason for not using tabs is that it's completely unpredictable how tabs will be displayed.

    (1-1/1)

    Please register to reply