Subject: Re: XML->ascii Conversion From: Charlotte Allen <Charlotte.Allen@xxxxxxxxxxxx> Date: Thu, 19 Aug 1999 16:19:19 -0700 (PDT) |
Mitch, Basically, you want something like this: xsl: ---------------------------------------- <!DOCTYPE xsl:stylesheet SYSTEM "xsl-html.dtd"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns="http://www.w3.org/TR/REC-html40"> <xsl:output method="text" indent="no"/> <!-- Root template - start processing here --> <xsl:template match="/"> <xsl:text>firstname lastname phone</xsl:text> <xsl:apply-templates select="./*"/> </xsl:template> <xsl:template match="order"> <xsl:value-of select="./customer/firstname/text()"/> <xsl:text> </xsl:text> <xsl:value-of select="./customer/lastname/text()"/> <xsl:text> </xsl:text> <xsl:value-of select="./customer/phone/text()"/> </xsl:template> </xsl:stylesheet> ------------------------------------------------------------------- which will generate this ascii from your xml: ------------------------------------------------------------------- firstname lastname phone John Doe (510) 555-1212 Jane Smith (916) 555-1212 ------------------------------------------------------------------- Note that my XSL processor (LotusXSL v0.17.0) seems to be ignoring my indent="no" instruction and is adding white space before the first names. Anyone know why this might be? Or is there something else I missed? Hopefully your XSL processor will not do this. Hope this is helpful. Charlotte Allen > Date: Thu, 19 Aug 1999 14:37:28 -0700 > From: Mitch Christensen <mitch_christensen@xxxxxxxxx> > X-Accept-Language: en > MIME-Version: 1.0 > To: xsl-list@xxxxxxxxxxxxxxxx > Subject: Re: XML->ascii Conversion > > Hi Mike, > > Thanks for responding. I'll try to be both specific and consise. > > I want to translate the following... > > <orderlist> > <order ordernum="1"> > <customer> > <firstname>John</firstname> > <lastname>Doe</lastname> > <phone>(510) 555-1212</phone> > </customer > </order> > <order ordernum="2"> > <customer> > <firstname>Jane</firstname> > <lastname>Smith</lastname> > <phone>(916) 555-1212</phone> > </customer > </order> > </orderlist> > > into a tab-delimited ascii file for import into QuickBooks like this... > > firstname lastname phone > John Doe (510) 555-1212 > Jane Smith (916) 555-1212 > > My current model is as follows... > > qbout.xml- +-----------+ > \ | | > +-->+ ixslt.exe +---> outfile.txt > / | | > qb2ascii.xsl- +-----------+ > > I just can't seem to get this to work. > > If you have an example or any advice at all, I would greatly appreciate it. > > Thanks, > Mitch > > > Mike Brown wrote: > > > > I need to convert XML to straight ascii text. > > > > Are you wanting to convert an XML document from one character set encoding > > like UTF-8 to US-ASCII, so the document is the same, i.e. markup and data, > > just with some of the characters changed to something suitable for your > > display ... or are you wanting to emit, for example, just the names of > > elements and their contents, perhaps like myElement: 'someValue', or what? > > Be more specific, showing what you have as input and what you want as > > output. > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: XML->ascii Conversion, Mike Brown | Thread | Multi-Line Elements, Mitch Christensen |
RE: XML->ascii Conversion, Mike Brown | Date | ANNOUNCE: NEW XML & XSL Editor for , Wattle Software |
Month |