This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Concat strings
- To: xsl-list at mulberrytech dot com
- Subject: Concat strings
- From: "Maulik Modi" <mxmodi at duke-energy dot com>
- Date: Tue, 19 Sep 2000 19:13:26 -0500
- Reply-To: xsl-list at mulberrytech dot com
Hi,
I want to create <td> cell names to uniquely identufy each data cell that I
create. I think I am almost there, just need a brush up on how to concatenate
strings in XSLT. Thanks for the help.
Following is my sample XML file:
<queryemp>
<parameters>
<Name></Name>
</parameters>
<data>
<Name>Joe Smith</Name>
<Name>Maulik Modi</Name>
<Name>Test1</Name>
<Name>Test2</Name>
<Week>09/03/2000 - 09/10/2000</Week>
<Week>08/03/2000 - 08/10/2000</Week>
<Week>05/05/2000 - 05/12/2000</Week>
<Week>09/03/2000 - 09/10/2000</Week>
</data>
</queryemp>
Following is my sample XSL file:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head></head>
<body>
<table border="1" cellpadding="2" cellspacing="0" width="100%" align="center">
<tr bgcolor="#c3c3c3" style="color:black">
<th>Employee</th>
<th>Week Of:</th>
</tr>
<xsl:apply-templates select=".//data/Name" />
</table>
</body>
</html>
</xsl:template>
<xsl:template match="Name">
<tr align="center">
<xsl:if test="position() mod 2 = 0">
<xsl:attribute name="bgcolor">#ffcc60</xsl:attribute>
</xsl:if>
<td><xsl:attribute name="name"><xsl:variable name="namepos"
select="position()"/><xsl:value-of
select="'name'+string($namepos)" /></xsl:attribute><xsl:value-of
select="."/></td>
<td><xsl:attribute name="name"><xsl:variable name="namepos"
select="position()"/><xsl:value-of
select="'week'+string($namepos)" /></xsl:attribute><xsl:value-of
select="."/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list