RE: XSL+XML -> Non-HTML

Subject: RE: XSL+XML -> Non-HTML
From: "Yvon Sauvageau" <ys@xxxxxxxxxxxx>
Date: Mon, 24 May 1999 10:42:12 -0400
John,

I've never tried <xsl:text>, but I think you should write something like:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>

<xsl:template match="/">
  <xsl:apply-templates select="ErrorList/Error"/>
</xsl:template>

<xsl:template match="/ErrorList/Error">
  <xsl:text>; </xsl:text>
  <xsl:text>
;
  ErrDef %</xsl:text>
</xsl:template>
</xsl:stylesheet>


Hope this helps,

-- Yvon

------------------------------

Date: Thu, 20 May 1999 17:18:54 -0600
From: John Dunn <johnd@xxxxxxxxxxxxx>
Subject: XSL+XML -> Non-HTML

Hello-

I am looking for examples of XSL for non-HTML output. I am trying to
generate HTML documentation and an asm  header file from the same XML file,
and am having problems with plain text output. Say I have XML like

<ErrorList>
  <Error identifier="ERROR_NO_ERROR" numeric="00">
    <Description>no error</Description>
  </Error>
  <Error identifier="ERROR_FOO" numeric="01">
    <Description>foo happens</Description>
  </Error>
<ErrorList>

and would like to generate:

; no error
;
  ErrDef $00,ERROR_NO_ERROR

; foo happens
  ErrDef  $01,ERROR_FOO

from the XML. I can generate plain text output ( using the IBM LotusXSL
parser ), but am having problems with generating Tabs/Whitespace and
Carriage Returns.

When I apply this style sheet-

<xsl:template match="CobraNet/ErrorList/Error">
; <xsl:value-of select="Description"/>
;
  ErrDef  $<xsl:value-of select="@numeric"/>,<xsl:value-of
select="@identifier"/>

</xsl:template>

I get

; no error
;
  ErrDef  $00,ERROR_NO_ERROR
; foo happens
;
  ErrDef  $01,ERROR_FOO

which is missing the returns after each error. More importantly, I would
like my style sheet to not depend on whitespace, but specify that whitespace
be generated. Perhaps more like ( note that xsl:generate is a hopeful
fabrication on my part ):

<xsl:template match="CobraNet/ErrorList/Error">
  <xsl:generate "; ">
  <xsl:value-of select="Description"/>
  <xsl:generate "\r">;
  <xsl:generate ";\r">;
  <xsl:generate "  ErrDef %"><xsl:value-of select="@numeric"/>
  <xsl:generate ",">
  <xsl:value-of select="@identifier"/>
  <xsl:generate "\r">;
</xsl:template>


Any ideas/suggestions?

- -John

- --
John Dunn
Peak Audio, Inc.
johnd@xxxxxxxxxxxxx
http://www.peakaudio.com
303.449.9337x103


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


Current Thread