This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How can I choose to ouput different nodeElement....


there is something wrong with my XSL:
I know I can repeat the whole paragraph  in both  when  and otherwise container.
But I do not think that is a wise way to do this.

can u give me some advice ?? 

XML below::
<?xml version="1.0" encoding="GB2312"?>
<toplist>
<title>World Version 2001/12/27 news Top10</title>
<media id="1" num="55">ChinaNewsNet</media>
<media id="2" num="43">XinHua News</media>
<media id="3" num="29">People News</media>
<media id="4" num="11">YangZi newsPaper</media>
<foot>before 2001-12-27 17:54:29.294,total 292 pieces </foot>
</toplist>


XSL below...
<?xsl version="1.0" encoding="GB2312"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

<xsl:template match="/toplist">
<table width="700" cellpadding="2" cellspacing="2" border="5">
<tr bgcolor="dad8bb"><td align="center" colspan="3">
<xsl:value-of select="title"/>
</td></tr>
<xsl:for-each select="media">

<xsl:choose>
<xsl:when test="(@id mod 2)=0" >
	<tr bgcolor="#ffffcc"><td align=center>
</xsl:when>
<xsl:otherwise>
	<tr><td align=center>
</xsl:otherwise>
</xsl:choose>

<xsl:value-of select="@id"/>
</td>
<td align="center">
<xsl:value-of select="."/>
</td>
<td align="center">
<xsl:value-of select="@num"/>
</td></tr>
</xsl:for-each>
<tr align="center"><td colspan="3">
<xsl:value-of select="foot"/>
</td></tr>
</table>
</xsl:template>
</xsl:stylesheet>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]