[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Creating a batch file or shell script / Inserting line break

Subject: Creating a batch file or shell script / Inserting line breaks
From: Ragnar Schierholz <raschi@xxxxxxxxxx>
Date: Sun, 9 Jul 2000 00:53:06 -0500
shell script 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>&#10;</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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.