Hi,
I have an xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<members>
<faculty id="1">
<first_name>John</first_name>
<last_name>Doe</last_name>
</faculty>
<faculty id="5">
<first_name>Jane</first_name>
<last_name>Doe</last_name>
</faculty>
<faculty id="6">
<first_name>James</first_name>
<last_name>Smith</last_name>
</faculty>
<faculty id="7">
<first_name>Jane</first_name>
<last_name>Jones</last_name>
</faculty>
<faculty id="8">
<first_name>Harvey</first_name>
<last_name>Wallbanger</last_name>
</faculty>
<faculty id="9">
<first_name>Lisa</first_name>
<last_name>Lisa</last_name>
</faculty>
</members>
What I'd like to do is lay these out (with their full name which links to
their bio, which is named id.xml (replace id with the id attribute for each)
Basically, each td or li item should look like this: <a
href="faculty-bio(_dot_)jsp?faculty={(_at_)id}"><xsl:value-of select="first_name"
/> <xsl:value-of select="last_name" /></a> (yes, i use a variable,
this is just for simplicity's sake)
I tricked Firefox on a pc using floating divs to make this work:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="members">
<xsl:variable name="emailaddress" select="email"/>
<xsl:variable name="facultyname" select="first_name+''+last_name"/>
<xsl:for-each select="faculty">
<xsl:sort select="last_name" />
<div
style="float:left;position:relative;top:15px;clear:right;width:180px;height:20px;"><span
style="font-size:9pt; font-weight:bold; color:#003300;"><a
href="faculty-bio(_dot_)jsp?faculty={(_at_)id}"><xsl:value-of select="first_name"
/> <xsl:value-of select="last_name" /></a></span></div>
</xsl:for-each>
</xsl:template>
Of course this doesn't work in IE for PC. I am aware of the tree/recursive
nature of xsl, and have tried to use something like this, which I found in
previous posts:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="members">
<xsl:variable name="t-size" select="count(faculty)"/>
<xsl:variable name="half" select="ceiling($t-size div 2)"/>
<table style="width:100%;">
<xsl:for-each select="faculty[position() <= $half]">
<xsl:variable name="here" select="position()"/>
<tr>
<td><a href="faculty-bio(_dot_)jsp?faculty={(_at_)id}"><xsl:value-of
select="."/></a></td>
<td>
<xsl:choose>
<xsl:when test="../faculty[$here+$half]">
<xsl:value-of select="../faculty[$here+$half]"/>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
- but it doesn't work at all.
I would be grateful for any suggestions, help, or proven methods of doing
something like this.
--~------------------------------------------------------------------
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>
--~--