You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Linda Derezinski <li...@interfacecontrol.com> on 2000/03/01 23:04:00 UTC

How to force 0x0d 0x0a for end of line character?

When running on NT sp6 with the cvs versions of xalan & xerces as of last
Thursday.  The output file’s end of line character is 0x0A.  How do I get
0x0D 0x0A?

I tried forcing it by putting <xsl:text>&#0x0D&#0x0A</xsl:text> where I
wanted the line breaks in the xsl file, but that didn’t seem to get past the
parser.
Currently I am using <xsl:text>
</xsl:text>
to force the line breaks

Using <xsl:preserve-space elements = "STFM" /> didn’t effect the EOL char
for those fields either.

What am I missing here??  There has to be an easier way to handle this.

Running the following gives 0x0A as the end of line character
testxslt –in file:///x/my.xml -xsl file:///x/my.xsl  -out out.txt –text

Running the following gives 0x0D 0x0A as the end of line characters
testxslt –in file:///x/my.xml -xsl file:///x/my.xsl  –text >out.txt

my.xml file:
<DATABASE NAME="STDTEST">
    <SECTION NAME="DB">
        <RTAS ID="0" NAME="AAAAAAA" >
                <rawValue>0</rawValue>
        </RTAS>

        <RTDS ID="1" NAME="LightSensor1">
                <rawValue>0</rawValue>
        </RTDS>
    </SECTION>
</DATABASE>

my.xsl file:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/DATABASE/SECTION/*"><xsl:for-each select=".">
 data <xsl:value-of select="name(.)"/>, <xsl:value-of select="@ID"/>,
"<xsl:value-of select="@NAME"/>"
<xsl:for-each select="./*">
<xsl:if test="name(.)='ARRAY'"> numrecords = <xsl:value-of select="@LENGTH"
/>
 </xsl:if>
<xsl:if test="name(.)!='ARRAY'"> <xsl:value-of select="name(.)"/> =
<xsl:value-of select="."/><xsl:text>
</xsl:text>
</xsl:if><xsl:apply-templates/></xsl:for-each>end <xsl:value-of
select="name(.)"/>
</xsl:for-each> </xsl:template>
<xsl:template match="comment()"> </xsl:template>
<xsl:template match="RECORD/*"> <xsl:for-each select=".">
 <xsl:value-of select="name(.)"/> = <xsl:value-of select="."/>
</xsl:for-each> </xsl:template>
<xsl:template match="text()"/> </xsl:stylesheet>

Thanks for reading this far.

_______________________________________________________________
Linda Derezinski
Interface & Control Systems


Re: How to force 0x0d 0x0a for end of line character?

Posted by Keith Visco <kv...@exoffice.com>.
It doesn't get past the parser because you are missing the closing ';'

use "&#x0A;" note the ending ';'

--K

Linda Derezinski wrote:

> When running on NT sp6 with the cvs versions of xalan & xerces as of
> last Thursday.The output file’s end of line character is 0x0A.How do I
> get 0x0D 0x0A?
>
> I tried forcing it by putting <xsl:text>&#0x0D&#0x0A</xsl:text> where
> I wanted the line breaks in the xsl file, but that didn’t seem to get
> past the parser.
>
> Currently I am using <xsl:text>
>
> </xsl:text>
>
> to force the line breaks
>
> Using <xsl:preserve-space elements = "STFM" /> didn’t effect the EOL
> char for those fields either.
>
> What am I missing here??There has to be an easier way to handle this.
>
> Running the following gives 0x0A as the end of line character
>
> testxslt –in file:///x/my.xml -xsl file:///x/my.xsl -out out.txt
> –text
>
> Running the following gives 0x0D 0x0A as the end of line characters
>
> testxslt –in file:///x/my.xml -xsl file:///x/my.xsl –text >out.txt
>
> my.xml file:
>
> <DATABASE NAME="STDTEST">
>
> <SECTION NAME="DB">
>
> <RTAS ID="0" NAME="AAAAAAA" >
>
> <rawValue>0</rawValue>
>
> </RTAS>
>
> <RTDS ID="1" NAME="LightSensor1">
>
> <rawValue>0</rawValue>
>
> </RTDS>
>
> </SECTION>
>
> </DATABASE>
>
> my.xsl file:
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:output method="text"/>
>
> <xsl:template match="/DATABASE/SECTION/*"><xsl:for-each select=".">
>
> data <xsl:value-of select="name(.)"/>, <xsl:value-of select="@ID"/>,
> "<xsl:value-of select="@NAME"/>"
>
> <xsl:for-each select="./*">
>
> <xsl:if test="name(.)='ARRAY'"> numrecords = <xsl:value-of
> select="@LENGTH" />
>
> </xsl:if>
>
> <xsl:if test="name(.)!='ARRAY'"> <xsl:value-of select="name(.)"/> =
> <xsl:value-of select="."/><xsl:text>
>
> </xsl:text>
>
> </xsl:if><xsl:apply-templates/></xsl:for-each>end <xsl:value-of
> select="name(.)"/>
>
> </xsl:for-each> </xsl:template>
>
> <xsl:template match="comment()"> </xsl:template>
>
> <xsl:template match="RECORD/*"> <xsl:for-each select=".">
>
> <xsl:value-of select="name(.)"/> = <xsl:value-of select="."/>
> </xsl:for-each> </xsl:template>
>
> <xsl:template match="text()"/> </xsl:stylesheet>
>
> Thanks for reading this far.
>
> _______________________________________________________________
>
> Linda Derezinski
>
> Interface & Control Systems
>