This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

adding a newline to my output with XSL


Hi everyone, I'm a little new to XSL and need some help.  I'm using the
latest Xalan processor.  

I am trying to take an XML and create a pipe delimited file, or comma
delimited file.  My problem so far is that using the stylesheet below, all
newlines are eliminated, however, if I take out the '<xsl:strip-space
elements="*">' statement, then I get one value on each line.  What I would
like to do is put each "<Equity>" entry on a line with a '|' or a ',' as the
delimiter.

Thanks very much!
Pankaj

<?xml version="1.0"?>

<Equities>
 <Equity>
  <ACCOUNTS_FORMAT_ID>5</ACCOUNTS_FORMAT_ID>
  <ALPHA></ALPHA>
  <AUDIT_REPORT_ID>2245019</AUDIT_REPORT_ID>
  <BETA></BETA>
  <CCY_CODE></CCY_CODE>
  <CCY_CODE_NUM></CCY_CODE_NUM>
  <CCY_ID>-1</CCY_ID>
  <CCY_NAME>&lt;NONE&gt;</CCY_NAME>
  <CCY_TYPE>4</CCY_TYPE>
  <CTRY_CLASS>5</CTRY_CLASS>
  <CTRY_CODE></CTRY_CODE>
  <CTRY_CODE2></CTRY_CODE2>
</Equity>
<Equity>
  <ACCOUNTS_FORMAT_ID>2</ACCOUNTS_FORMAT_ID>
  <ALPHA>.09</ALPHA>
  <AUDIT_REPORT_ID>7829122</AUDIT_REPORT_ID>
  <BETA>1.343</BETA>
  <CCY_CODE>USD</CCY_CODE>
  <CCY_CODE_NUM>163</CCY_CODE_NUM>
  <CCY_ID>-1</CCY_ID>
  <CCY_NAME>US Dollar</CCY_NAME>
  <CCY_TYPE>2</CCY_TYPE>
  <CTRY_CLASS>5</CTRY_CLASS>
  <CTRY_CODE>USA</CTRY_CODE>
  <CTRY_CODE2>US</CTRY_CODE2>
</Equity>
</Equities>

and the following XSL

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format"; version="1.0">
	<xsl:output method="text" omit-xml-declaration="yes" indent="no" />
	<xsl:strip-space elements="*">
	<xsl:template match="/Equities" mode="listdetails">
   		<xsl:apply-templates />
    </xsl:template>

	<xsl:template match="/Equity" mode="listdetails">
		<xsl:value-of select="name()" />
		<xsl:value-of select="text()" /> 
		<xsl:text disable-output-escaping="yes"></xsl:text>
	</xsl:template>

</xsl:stylesheet>



----------------------------------------------------
This email with all information contained herein or attached hereto may
contain confidential and/or privileged information intended for the
addressee(s) only.  If you have received this email in error, please contact
the sender and immediately delete this email in its entirety and any
attachments thereto..



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]