RE: [xsl] Junk while transforming XML to text

Subject: RE: [xsl] Junk while transforming XML to text
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 25 Apr 2002 08:51:30 +0100
I don't know why you get the 163113109131 junk. The stuff that follows it
comes from applying the built-in template rules.

It might be useful to set up a template rule that explicitly ignores
elements by default:

<xsl:template match="*"/>

and then add template rules for those elements that you actually want to
process.

Also note that disable-output-escaping has no effect when using
method="text", because this output method never does any escaping.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Sripriya
> Venkataraman
> Sent: 25 April 2002 00:44
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: [xsl] Junk while transforming XML to text
>
>
> Hi,
>
> I am trying to convert an XML document to an ascii text file
> using XSL.
> When I do that, I get some junk at the beginning of the file.
>
> My input file XML is
> <PLATERESULTS>
> <ANALYSISOPTIONS>
> 	<GENERICOPTIONS Threshold="7%"/>
> </ANALYSISOPTIONS>
> <ANALYSISSTATUS>
> <PLATESTATUS><MESSAGE>Analysis Successful</MESSAGE><MESSAGE>(00000)
> Difference in Row Marker Height Between Sippers of 82%.  Low
> total of 8.526,
> High total of 46.436.</MESSAGE></PLATESTATUS>
> </ANALYSISSTATUS>
> <CHANNELRESULTS Channel="1" NoiseAvg="242.10" NoiseStdev="6.90">
> 	<WELLRESULTS>
> 	<WELL WellName="E7" WellStartTime="247.80" BaselineRSI="253.86"
> DipRSI="11.88" PositivePercentInhibition="7.29" PeakRSI="5.67"
> NegativePercentInhibition="3.48" NoiseFactor="1.36"
> MinMaxDifference="18.01"/>
> 	<WELL WellName="E24" WellStartTime="348.00" BaselineRSI="245.84"
> DipRSI="40.20" PositivePercentInhibition="24.66" PeakRSI="2.69"
> NegativePercentInhibition="1.65" NoiseFactor="1.36"
> MinMaxDifference="43.46"/>
> 	</WELLRESULTS>
> </CHANNELRESULTS>
> </PLATERESULTS>
>
> My input XSL is
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> 	<xsl:output method="text"/>
> 	<xsl:variable name="tab" select="'&#09;'" />
> 	<xsl:variable name="newline" select="'&#010;'" />
> 	<xsl:variable name="header">
>  		<xsl:text disable-output-escaping="yes">'&lt;START
> DataVersion</xsl:text>
> 		<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
> 		<xsl:text>'Version</xsl:text>
> 		<xsl:value-of select="$tab"/>
> 		<xsl:text>1</xsl:text>
> 	</xsl:variable>
>
> 	 <xsl:template match="CHANNELRESULTS[1]//WELL[1]">
> 	 	<xsl:value-of select="$header"/>
> 	 	<xsl:value-of select="$newline"/>
> 	 	<xsl:for-each select="@*">
> 				<xsl:value-of select="name()"/>
> 				<xsl:value-of select="$tab"/>
> 		 	</xsl:for-each>
> 		 	<xsl:value-of select="$newline"/>
> 	 </xsl:template>
> </xsl:stylesheet>
>
> But my output text file is:
> 163113109131Analysis Successful(00000) Difference in Row Marker Height
> Between Sippers of 82%. Low total of 8.526, High total of
> 46.436.''Version 1
> WellName WellStartTime BaselineRSI DipRSI
> PositivePercentInhibition PeakRSI
> NegativePercentInhibition NoiseFactor MinMaxDifference
>
> Why do I get this junk value ?
>
> Any help would be great.
> Thanks,
> Priya
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread