xsl-list
[Top] [All Lists]

Re: [xsl] How to get comments to indent on their own line in XML output?

2008-07-06 15:48:09

someone who apparently can't get English, xml, xslt or sed correct wrote:

  possibly the simplest
  thing to do is instead of using xsl:comment use 
  <myCommentElement>this is a comment<myCommentElement>
                                      
</myCommentElement>

  then it will indent as you wish. then to get it back to being a comment
  either do a second transform with an identity transform plust one

plus


  template to switch this back or just use

  sed -i -e "s/<myCommentElement>/<!--" -e "s/</myCommentElement>/-->" file.xml


sed -i -e "s@<myCommentElement>@<!--(_at_)g" -e "s@</myCommentElement>@-->@g" 
file.xml


  (or perl or any other language of choice).

  David

  PS sorry, in my reply to MDP I accused you of having been the source of 
  a surious <xs:text in an attribute value, it appears it was me, must have

spurious

  accidentally yanked it one line two early:-)

too

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--