[xsl] whitespace problem

Subject: [xsl] whitespace problem
From: "Devon Y." <vehementpetal@xxxxxxxxxxx>
Date: Tue, 08 Jul 2003 10:21:07 -0400
I've got these nodes that looks like:

<artist>
  <name>Commandos</name>
  <photo>commandos.jpg</photo>
  <song_title>Everybody's Way</song_title>
  <hash>dbs8ud9bq3ddffdf</hash>
  <bio>blah blah blah</bio>
  <buy_link>commandos.htm</buy_link>
  <sponser_name>Some Company</sponser_name>
  <sponser_url>http://www.some-company.com/</sponser_url>
  <date>2003-07-03</date>
</artist>

...and I need to turn these into text file of tab separated values, each artist element must have a line break after it. Basically I'm turning it into a .sql file. I'm having strange strange troubles though. I've done lots of transformations, but never into method='text' before, so I've never dealt with whitespace.

I've plowed through some articles at xml.com on whitespace, but nothing's working right. The examples work, but when I alter them to fit what I need, it leaves out the tab. I think the problem's in this, but I don't understand why the tabs & newline are being stripped, when they weren't stripped when I tried the example files -

<xsl:template match="artists">
 <xsl:apply-templates select="name"/>
 <xsl:text>&#9;</xsl:text>
 <xsl:apply-templates select="photo"/>
 <xsl:text>&#9;</xsl:text>
 <xsl:apply-templates select="song_title"/>
 <xsl:text>&#9;</xsl:text>
 <xsl:apply-templates select="date"/><xsl:text>
</xsl:text>
</xsl:template>

...I tried changing the xsl:apply-templates to xsl:value-of, and it didn't change the output. I'm really confused.


Dev


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus



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



Current Thread