--- Abel Braaksma <abel(_dot_)online(_at_)xs4all(_dot_)nl> wrote:
[somehow this didn't reach the list, retry. probably
outdated now though..]
Hi Oryan,
see my comments,
Cheers,
Abel
oryann9 wrote:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>My Phone Book</TITLE>
</HEAD>
<BODY BGCOLOR="BLACK">
<xsl:apply-templates select="//LISTING"
/>
You probably want just LISTING here. You are
selecting every possible
LISTING from the root through all the document when
you use //LISTING.
</BODY>
</HTML>
</xsl:template>
<xsl:template match="LISTING">
<FONT COLOR="WHITE"><xsl:value-of
select="LAST"/>,
<xsl:value-of select="FIRST"/></FONT>
<FONT COLOR="orange" SIZE="+2"><xsl:value-of
select="PHONE"/>
<xsl:choose>
<xsl:when test="boolean(PHONE/@TYPE)">
(<xsl:value-of select="PHONE/@TYPE" />)
No need for an xsl:choose. In almost all cases that
I've seen on this
list, xsl:choose is over-used, because it feels so
easy (or looks so
much like in the other programming languages).
Instead, use:
<FONT COLOR="orange" SIZE="+2">
<xsl:apply-templates select="PHONE" />
then, have twotemplate matches (one for empty or
non-existing @TYPE, the
other for all other @TYPE):
<xsl:template match="PHONE[(_at_)TYPE='' | not(@TYPE)]" >
<xsl:value-of select="."/> (HOME)
</
<xsl:template match="PHONE[(_at_)TYPE != '']">
<xsl:value-of select="."/> (<xsl:value-of
select="PHONE/@TYPE" />)
</
Hi to all!
I thank you all very much for all the assistance you
have provided since I am new to XSL(T).
Allow me some more time to absorb and practice what
was sent. :)
____________________________________________________________________________________
Choose the right car based on your needs. Check out Yahoo! Autos new Car
Finder tool.
http://autos.yahoo.com/carfinder/
--~------------------------------------------------------------------
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>
--~--