View Single Post
  #2 (permalink)  
Old September 4th, 2019, 04:14 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I would suggest getting rid of the single-line comments the way you do now, then merge all the SQL lines into one using string-join() with newline as a separator, then get rid of the multi-line comments the way you do now, then split it up again into separate lines (if that's the way you need it) using xsl:analyze-string.

A caveat is that I don't think you are correctly handling lines that contain more than one comment. It would be easier to do that using regular expressions (e.g. replace() or xsl:analyze-string) rather than using substring-before and substring-after.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
The Following User Says Thank You to mhkay For This Useful Post:
msambasiva@gmail.com (September 4th, 2019)