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: Tab delimited file


>Given the following XML
>
><?xml version="1.0"?>
><results>
><assetType>Bond</assetType>
>...
><assetType>Warrant</assetType>
></results>
>
>I want to output a tab delimited file like
>
>Asset List
>
>#	Name
>1	Bond
>2	Bond

I thought that since the stylesheet uses a tab twice, it was worth defining
it as an entity so that it would look cleaner in the code:

<?xml version="1.0"?>
<!DOCTYPE stylesheet [  
<!ENTITY tab "<xsl:text>&#9;</xsl:text>">
]>
  <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="assetType">
      <xsl:number/>&tab;<xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="results">
Asset List

#&tab;Name
    <xsl:apply-templates/>
  </xsl:template>

</xsl:stylesheet>


Bob DuCharme       www.snee.com/bob       <bob@  
snee.com>  see www.snee.com/bob/xmlann for "XML:
The Annotated Specification" from Prentice Hall.


 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]