[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Table type output in text fromat in a xml file

Subject: Re: Table type output in text fromat in a xml file
From: rasha dwidar <rasha_dwidar@xxxxxxxxx>
Date: Thu, 27 Dec 2007 00:45:44 -0800 (PST)
Re:  Table type output in text fromat in a  xml file
Hi All,

Thanks for your prompt reply but I need the result to be in text format not html format.

Ken,  I did something like that before but it lost the indentation as table format. Do u know how I can implement indentation or padding so I can have the same look and feel as table format. As If I have testcase name = test000000000000000001, I will lose the alignment in the table.


----- Original Message ----
From: G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx>
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Sent: Wednesday, December 26, 2007 5:06:14 PM
Subject: Re:  Table type output in text fromat in a  xml file

 At 2007-12-26 13:21 -0800, rasha dwidar wrote:
>I have xml file as mentioned below. I want to use xsl to display it 
>in text format. I want to present xml data in table in text format. 
>Is that possible?

Yes ... use method="text" and all of the text nodes of the result 
tree are serialized into the result, with the element markup  suppressed.

>XML file
>I want to display it in text format like that.
>I appreciate your help

I hope the example below helps ... it is using XSLT 2.0 ... if you 
need to use XSLT 1.0, change:

    <xsl:value-of select="'  ',@name,'  ',@result,'  ',@comment"/>


    <xsl:value-of select="concat('   ',@name,'   ',@result,'    ',@comment)"/>

. . . . . . . . . . Ken

T:\ftemp>type rasha.xml
<testcase name="test001" result="failed" comment="test failed"/>
<testcase name="test001" result="failed" comment="test failed"/>
<testcase name="test001" result="passed" comment="test passed"/>

T:\ftemp>type rasha.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:output method="text"/>

<xsl:template match="test">
    Name       Result    Comment
   <xsl:apply-templates select="testcase"/>

<xsl:template match="testcase">
   <xsl:value-of select="'  ',@name,'  ',@result,'  ',@comment"/>

T:\ftemp>xslt2 rasha.xml rasha.xsl rasha.txt

T:\ftemp>type rasha.txt

    Name       Result    Comment
    test001    failed    test failed
    test001    failed    test failed
    test001    passed    test passed


Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.