Sign In/My Account | View Cart  
advertisement

Article:
 Controlling Whitespace, Part 1
Subject: stripping out tabs and cr
Date: 2004-12-07 05:03:57
From: Boris Rousseau
Response to: stripping out tabs and cr

I am using this code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">


<xsl:output method="xml" omit-xml-declaration="yes"/>


<xsl:strip-space elements="*"/>


<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>


</xsl:stylesheet>


Nevertheless, I am still getting some whitespaces (due to carriage returns and/or tabs). And I am using the Java 2 javax.xml.transform class as the XSLT processor.


No Previous Message Previous Message Move up to Parent Message Up Next Message No Next Message


Titles Only Titles Only Newest First
  • stripping out tabs and cr
    2004-12-07 05:49:53 Bob DuCharme [Reply]

    First, check that your xmlns:xsl attribute value has a closing quote, because it didn't in the one that you included in your message.


    Second, try it with Saxon and Xalan. I tried it with Saxon, Xalan Java, and libxslt after fixing the quote problem described above, and it worked properly with all of them. If this is the case with you, then the problem is in your use of the javax.xml.transform class and not in the stylesheet.


    Bob

    • stripping out tabs and cr
      2004-12-07 06:40:31 Boris Rousseau [Reply]

      I have solved the problem in my java code while parsing the document instead of using xslt.


      Thanks for your help.


Sponsored By: