Creating a batch file or shell script / Inserting line break
Hi! I have a slight output formatting problem. I have a source file in the following format: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE survey SYSTEM "survey.dtd" > <survey> <section xlink:href="Section1.xml"/> <section xlink:href="Section2.xml"/> </survey> What I would like to produce now is a stylesheet that takes this as input and produces a batch file and/or a shell script which invokes Xalan for each of the mentioned section source files. The output should be something like this: java org.apache.xalan.xslt.Process -in Section1.xml -xsl section.xsl -out Section1.html -INDENT 2 java org.apache.xalan.xslt.Process -in Section2.xml -xsl section.xsl -out Section2.html -INDENT 2 What I tried is the following: <xsl:stylesheet version="1.0" xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:xlink='http://www.w3.org/1999/xlink'> <xsl:output method="txt" encoding="UTF-8"/> <xsl:template match="section"> <xsl:variable name="URI"><xsl:value-of select=" @xlink:href"/></xsl:variable> <xsl:variable name="filename"><xsl:value-of select ="substring-before($URI,'xml')"/></xsl:variable> java org.apache.xalan.xslt.Process -in <xsl:value-of select ="$URI"/> -xsl section.xsl -out <xsl:value-of select="concat ($filename,'html')"/> -INDENT 2 </xsl:template> </xsl:stylesheet> But unfortunatley Xalan always writes all output on a single line. This causes syntax errors when the file is invoked as a batch file. Does anybody have an idea how to create a line break after each section element? I already tried the <xsl:text> </xsl:text which occured earlier in this list, but Xalan ignored that. Funnily enough, if I switch the output method to "html" I get separated lines, but I get an extra blank line before and after every element, which causes two blank lines between the elements. Since my input files might contain many <section> elements, I would rather have just on line break after the command. Thanks in advance, Ragnar 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