[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: method='text' ... whitespace problems
A newline in an XML document is normalized by the XML parser to x0A. The spec for the text output method says nothing about how the x0A will be serialized; I think a literal reading suggests it should be output as x0A, though I don't think one could quarrel with a processor that used the platform-specific line ending sequence (i.e., x0D0A on Windows). If you want to control this, I think you will have to use character references in your stylesheet, to prevent the XML parser normalizing them, and you will need to include your own logic (e.g. a stylesheet parameter) to decide whether to output x0A or x0D0A. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > DPawson@xxxxxxxxxxx > Sent: 18 November 2002 16:05 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: method='text' ... whitespace problems > > > I'm having fun and games generating some plain text output. > > > Requirement is to produce something akin to > > [begin label: ] > > content > content > etc > > [end label] > > I.e. each 'block' is seperated by one newline > from its predecessor, and has one newline > between the block start ([ .... ] ) > and block end [end ....] > > I really don't know if the user wants to process on *nix > or win32, hence I have > > <!DOCTYPE xsl:stylesheet [ > <!ENTITY nl "<xsl:text> > </xsl:text>"> > <!ENTITY indent "<xsl:text> </xsl:text>"> > ]> > > The indent is not giving any problems, but the newline > certainly is. I'm beginning to suspect its the viewer I'm > using (as with encoding issues). > > > Typically I'm using > > <xsl:template match="element"> > &nl;[begin thisLabel: ] > <xsl:apply-templates/> > [end thisLabel] > </xsl:template> > > > which is not producing what I expect. > > I'm looking for an explanation of what happens with > output='text', within a template, and for suggestions as to a > definition of the nl entity which might suit either/both > win32 + *nix environs. > > > TIA, DaveP > > > > **** snip here ***** > > - > > NOTICE: The information contained in this email and any > attachments is > confidential and may be legally privileged. If you are not the > intended recipient you are hereby notified that you must not use, > disclose, distribute, copy, print or rely on this email's content. If > you are not the intended recipient, please notify the sender > immediately and then delete the email and any attachments from your > system. > > RNIB has made strenuous efforts to ensure that emails and any > attachments generated by its staff are free from viruses. However, it > cannot accept any responsibility for any viruses which are > transmitted. We therefore recommend you scan all attachments. > > Please note that the statements and views expressed in this email > and any attachments are those of the author and do not necessarily > represent those of RNIB. > > RNIB Registered Charity Number: 226227 > > Website: http://www.rnib.org.uk > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|