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"/>
to:
<xsl:value-of select="concat(' ',@name,' ',@result,' ',@comment)"/>
. . . . . . . . . . Ken
T:\ftemp>type rasha.xml
<test>
<testcase name="test001" result="failed" comment="test failed"/>
<testcase name="test001" result="failed" comment="test failed"/>
<testcase name="test001" result="passed" comment="test passed"/>
</test>
T:\ftemp>type rasha.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="text"/>
<xsl:template match="test">
<xsl:text>
Name Result Comment
</xsl:text>
<xsl:apply-templates select="testcase"/>
</xsl:template>
<xsl:template match="testcase">
<xsl:value-of select="' ',@name,' ',@result,' ',@comment"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
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
T:\ftemp>
--
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(_at_)CraneSoftwrights(_dot_)com
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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--