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

Adding newline changes output formatting

Subject: Adding newline changes output formatting
From: Albert Chin <xsl-list@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Feb 2003 09:48:43 -0600
xsltproc newline
I have XML input:
  <?xml version="1.0"?>
  <packages>
    <package>
      <category>Applications/Internet</category>

      <install-name>test</install-name>
and want to duplicate this as output using the XSLT input:
  <xsl:template match="/">
    <xsl:element name="packages">
      <xsl:for-each select="packages/package">
        <xsl:element name="package">
          <xsl:copy-of select="category"/>

          <xsl:if test="string(category)">
            <xsl:text>&#10;</xsl:text>
          </xsl:if>

        ...
        </xsl:element>
      </xsl:for-each>
    </xsl:element>
  </xsl:template>

Using xsltproc 1.0.23 I get:
  <?xml version="1.0"?>
  <packages>
    <package><category>Applications/Internet</category>
  </package>
  </packages>

If I remove:
          <xsl:if test="string(category)">
            <xsl:text>&#10;</xsl:text>
          </xsl:if>
I get:
  <?xml version="1.0"?>
  <packages>
    <package>
      <category>Applications/Internet</category>
    </package>
  </packages>

So why does inserting a newline mess up the output?

-- 
albert chin (china@xxxxxxxxxxxxxxxxxx)

 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.