xsl-list
[Top] [All Lists]

RE: RE: XML to HTML

2005-09-20 03:58:00
Hi,

With the given xsl i have transform the xml file.

Get the below output:
<h1>Topic Group Title</h1>
<h2>Topic Title</h2>
<h2>Topic Title</h2>
<h2>Topic Title</h2>

Here is the sample xsl which gives what i want exaclty, Problem: Is there
any other shortest way to get the TopicGroup in H1 and all the src present
in that in h2. Same for Topic in h1 and src presents in that in h2.

XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:tm="urn:xmlintl-tm-tags">
<xsl:output method="html" indent="yes"/>

<xsl:template match="qxf">
        <xsl:apply-templates select="docmain/Chapter/TopicGroup"/>
</xsl:template>

<xsl:template match="TopicGroup">
<table align="center" width="100%">
        <tbody>
                <tr>
                        <td class="header" bgcolor="#0099CC;"><font
size="10"><xsl:value-of select=".//src"/></font></td>
                </tr>
        </tbody>
</table>
<p align="left "><font size="4">
                <xsl:value-of select="BodySummary/Blurb//src"/></font>
</p>
<p align="left "><font size="4">
                <xsl:value-of
select="BodySummary/Blurb/tm:te/IndexEntry//src"/></font>
</p>
<p align="left "><font size="4">
                <xsl:value-of
select="BodySummary/Blurb/tm:te/IndexEntry/tm:te//src"/></font>
</p>
<p align="left "><font size="4">
                <xsl:value-of select="BodySummary/Para/tm:te//src"/></font>
</p>
<h3>Note:
        <xsl:value-of select="BodySummary/Note/tm:te//src"/>
</h3>
<xsl:apply-templates select="Topic"/>
</xsl:template>

<xsl:template match="Topic">
        <h2 align="center"><xsl:value-of select="Title//src"/></h2> 
</xsl:template>
</xsl:stylesheet>

--
Shailesh



-----Original Message-----
From: Joris Gillis [mailto:roac(_at_)pandora(_dot_)be] 
Sent: Tuesday, September 20, 2005 2:35 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] RE: XML to HTML

Hi,
Tempore 10:03:45, die 09/20/2005 AD, hinc in 
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
scripsit Shailesh Shinde <shailesh(_at_)quagnito(_dot_)com>:

By using below tempalte I am get the output but with some other content
which i don't want. I have to display TopicGroup title in h1 and the rest
of
the child element src values in h2 under that particular topicgroup.

Maybe you want the output to be:

<h1>Topic Group Title</h1>
<h2>Topic Title</h2>
<h2>Topic Title</h2>
<h2>Topic Title</h2>
<h1></h1>

In that case, try this stylesheet:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" indent="yes"/>

<xsl:template match="qxf">
        <xsl:apply-templates select="docmain/Chapter/TopicGroup"/>
</xsl:template>

<xsl:template match="TopicGroup">
        <h1><xsl:value-of select=".//src"/></h1>
        <xsl:apply-templates select="Topic"/>
</xsl:template>

<xsl:template match="Topic">
        <h2><xsl:value-of select="Title//src"/></h2>
</xsl:template>

</xsl:stylesheet>


regards,
-- 
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Don't send spam. I don't like it and it is illegal.

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




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



<Prev in Thread] Current Thread [Next in Thread>