xsl-list
[Top] [All Lists]

[xsl] Re: Formatting issue with HTML and TEXT output method

2008-07-17 09:51:04
Hi ,
Here is my sample xslt and xml .
html.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html" omit-xml-declaration="no" indent="yes"/>

<xsl:template match="/content">
        <xsl:copy>
                <xsl:apply-templates/>
        </xsl:copy>
</xsl:template>

<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
</head>
<body>
<table width="100%"  valign="top">
<tr>
<td colspan="2" style="text-align:justify;">
<xsl:value-of select="//name"/>
</td></tr>
<tr>
<td colspan="2" style="text-align:justify;">
<xsl:copy-of select="//cond"/></td></tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

text.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="text" encoding="UTF-8" />

<xsl:template match="/content">
        <xsl:copy>
                <xsl:apply-templates />
        </xsl:copy>
</xsl:template>
<xsl:template match="/">
NAME <xsl:value-of select="//name"/>
<xsl:copy-of select="//cond"/>
</xsl:template>
</xsl:stylesheet>


content.xml


<content>
<name>
Senthil
</name>
<cond>
<html>
<body>
<p align="center">
TESTTESTTESTTESTTESTTESTTESTTESTTEST
TESTTESTTESTTESTTESTTESTTESTTESTTEST
TESTTESTTESTTESTTESTTESTTESTTESTTEST
</p>
<p align="center">
TESTTESTTESTTESTTESTTESTTESTTESTTEST
TESTTESTTESTTESTTESTTESTTESTTESTTEST
TESTTESTTESTTESTTESTTESTTESTTESTTEST
</p>
</body>
</html>
</cond>
</content>


Thanks,
Senthil

On Wed, Jul 16, 2008 at 4:38 PM, Senthilkumaravelan K
<skumaravelan(_at_)googlemail(_dot_)com> wrote:
Hi All,
We have xml
<note>
<cond>
<html>
<body>
<p align="center">
TESTTESTTESTTESTTESTTESTTESTTESTTEST
TESTTESTTESTTESTTESTTESTTESTTESTTEST
TESTTESTTESTTESTTESTTESTTESTTESTTEST
</p>
<p align="center">
TESTTESTTESTTESTTESTTESTTESTTESTTEST
TESTTESTTESTTESTTESTTESTTESTTESTTEST
TESTTESTTESTTESTTESTTESTTESTTESTTEST
</p>
</body>
</html>
</cond>
<note>

When we write xslt one with "html" as output method and text as output method.

for html out method am using
<xsl:value-of select="//cond">

text output method
<xsl:copy-of select="//cond">


How to make the text xslt output like formatted text output pretty
with alignment.

Any idea would of great help.

Thanks
Senthil


--~------------------------------------------------------------------
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>
--~--