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]

RE: White space control when formatting for ascii text


I've noticed this in other ascii application when transferring data from
unix to windows.

-----Original Message-----
From: Rick Anderson [mailto:rianders@rci.rutgers.edu]
Sent: Tuesday, October 17, 2000 3:29 PM
To: XSL-List@mulberrytech.com
Subject: White space control when formatting for ascii text


I'm attempting to transform some xml into nicely formatted ascii style
text instead of to html.  I've been using tabs to align my columns but
sometimes I get extra tabs. I don't know why.

It seems to be very difficult to control the white space in the style
sheet.  Is there a way to make the white space more visibile for better
debugging? 

I switched to using the unicode characters for return and tab.  
return = 
 and tab = 	 so that I could know what tabs and line
breaks I was putting in.

Maybe I've missed something.

Style sheet output:
-------------------

<?xml version="1.0" encoding="utf-8"?>
This is a listing of fields by category

Category:  People

PersonID        Global unique identifier for a person.
      SSN       Social Security Number
      Firstname First Name
      Lastname  Last Name
      Middlename        Middle Name
      DOB       Date of birth
      Gender    Gender of the person.
^
|--------no reason for tab here.

Style sheet:
------------
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>

<xsl:template match="fieldlist">
<xsl:text>This is a listing of fields by category&#xA;</xsl:text>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="table">
<xsl:text>&#xA;</xsl:text>
<xsl:text>Category:  </xsl:text>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="name">
<xsl:apply-templates/>
<xsl:text>&#xA;&#xA;</xsl:text>
</xsl:template>

<xsl:template match="field">
<xsl:value-of select="@name"/>
<xsl:text>&#9;</xsl:text>
<xsl:apply-templates/>
</xsl:template>


<xsl:template match="desc">
<xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>

Original xml:
-------------
<?xml version="1.0" standalone="no"?>
<!DOCTYPE fieldlist SYSTEM "fieldlist.dtd">
<fieldlist>
  <table>
    <name>People</name>

    <field name="PersonID" type="Number(10)" keytype="PRIMARY KEY">
      <desc>Global unique identifier for a person.
      </desc>
    </field>

    <field name="SSN" type="varchar2(9)" keytype="NOT NULL">
      <desc>Social Security Number
      </desc>
    </field>

    <field name="Firstname" type="varchar2(20)" keytype="">
      <desc>First Name
      </desc>
    </field>

    <field name="Lastname" type="varchar2(20)" keytype="">
      <desc>Last Name
      </desc>
    </field>

    <field name="Middlename" type="varchar2(20)" keytype="">
      <desc>Middle Name
      </desc>
    </field>

    <field name="DOB" type="Date" keytype="">
      <desc>Date of birth
      </desc>
    </field>

    <field name="Gender" type="char(1)" keytype="">
      <desc>Gender of the person.
      </desc>
    </field>
  </table>
</fieldlist>

______________________________________________________
Rick Anderson	| rianders@rci.rutgers.edu
________________|_____________________________________
Continuous Education & Outreach
Manager of Computer Systems,  (732)932-5071
______________________________________________________



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


 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]