XSL stylesheet: why do data appear outside table?

S

Sharon

Hiya,
I have this stylesheet (based on an example @
http://rdcpro.com/xmldev/filterandsort)which I'm trying to modify so
that it will work for my own XML and I get some data but it doesn't
appear within the table as intended. Does anyone know why this is?
This is my XSL followed by my XML. I hope someone can help me! love,
Sharon

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:dates="urn:rdcpro-com:dates"<xsl:eek:utput method="xml" encoding="UTF-8"/>
<xsl:param name="username" select="general/data/rows/row"/>
<xsl:param name="city" select="$username/fvalues/fcity"/>
<xsl:param name="debiteurnr" select="$username/fvalues/fdebno"/>
<xsl:param name="direction">ascending</xsl:param>
<xsl:param name="sortBy">fusername</xsl:param>
<xsl:variable name="tableData">
<xsl:apply-templates
select="$username/fvalues[fcity=$city][fdebno=$debiteurnr]"
mode="tableData" />
</xsl:variable>
<xsl:template match="general/data">
<div align="left">
<div class="content" align="right" style="padding-bottom:4px;">
Sort Direction:
<xsl:value-of select="$direction"/>
<br/>
Sort Column:
<xsl:value-of select="$sortBy"/>
</div>
<table border="1" class="results" align="center" cellpadding="5"
cellspacing="0">
<tr>
<th>
<a class="clickanchor" onclick="renderData('fclient');">
<xsl:value-of select="cols/fclient/@caption"/>
</a>
</th>
<th>
<a class="clickanchor" onclick="renderData('fid');">
<xsl:value-of select="cols/fid/@caption"/>
</a>
</th>
<th>
<a class="clickanchor" onclick="renderData('fusername');">
<xsl:value-of select="cols/fusername/@caption"/>
</a>
</th>
<th>
<a class="clickanchor" onclick="renderData('fname');">
<xsl:value-of select="cols/fname/@caption"/>
</a>
</th>
<th>
<a class="clickanchor" onclick="renderData('fcity');">
<xsl:value-of select="cols/fcity/@caption"/>
</a>
</th>
<th>
<a class="clickanchor" onclick="renderData('fdebno');">
<xsl:value-of select="cols/fdebno/@caption"/>
</a>
</th>
</tr>
<xsl:apply-templates select="msxsl:node-set($tableData)">
<xsl:sort select="*[name()=$sortBy]" order="{$direction}"/>
</xsl:apply-templates>
</table>
</div>
</xsl:template>
<xsl:template match="rows/row/fvalues">
<tr>
<xsl:for-each select="*">
<xsl:if test="/general/data/cols/*[name()=name(current())]/@visible='True'">
<td>
<xsl:value-of select="."/>
</td>
</xsl:if>
</xsl:for-each>
</tr>
</xsl:template>
<xsl:template match="fvalues" mode="tableData">
<xsl:copy>
<xsl:for-each select="*">
<xsl:if test="/general/data/cols/*[name()=name(current())]/@visible='True'">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>



<?xml version="1.0" encoding="utf-8" ?>
<general>
<data>
<header></header>
<global>
<orderby />
<created />
</global>
<cols>
<fclient caption="Client" color="" width="70" type="number"
visible="True" />
<fid caption="Sleutelveld" color="" width="40" type="number"
visible="True" />
<fusername caption="Username" color="" width="60" type="number"
visible="True" />
<fname caption="Naam" color="" width="120" type="text"
visible="True" />
<fcity caption="Woonplaats" color="" width="100" type="text"
visible="True" />
<factive caption="Active" color="" width="60" type="text"
visible="False" />
<fdebno caption="debiteurnr" color="" width="80" type="number"
visible="True" />
<fpassword caption="password" color="" width="10" type="text"
visible="False" />
</cols>
<rows>
<row>
<id value="32" />
<fvalues>
<fclient>0</fclient>
<fid>103</fid>
<fusername>Pietje</fusername>
<fname>Pieters Autotransport B.V.</fname>
<fcity>Hoogeveen</fcity>
<factive>True</factive>
<fdebno>1</fdebno>
<flanguage>NL</flanguage>
<fpassword>Flup</fpassword>
</fvalues>
</row>
<row>
<id value="43" />
<fvalues>
<fclient>0</fclient>
<fid>43</fid>
<fusername>willie</fusername>
<fname>willie bruining</fname>
<fcity>blijham</fcity>
<factive>True</factive>
<fdebno>8</fdebno>
<flanguage>NL</flanguage>
<fpassword>Kwik</fpassword>
</fvalues>
</row>
<row>
<id value="21" />
<fvalues>
<fclient>0</fclient>
<fid>83</fid>
<fusername>Bertje</fusername>
<fname>Bertje Autotransport B.V.</fname>
<fcity>Meppel</fcity>
<factive>True</factive>
<fdebno>1</fdebno>
<flanguage>NL</flanguage>
<fpassword>Kwek</fpassword>
</fvalues>
</row>
<row>
<id value="64" />
<fvalues>
<fclient>0</fclient>
<fid>73</fid>
<fusername>Billie</fusername>
<fname>Billie bruining</fname>
<fcity>billieham</fcity>
<factive>True</factive>
<fdebno>8</fdebno>
<flanguage>NL</flanguage>
<fpassword>Kwak</fpassword>
</fvalues>
</row>
</rows>
</data>
<footer></footer>
</general>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top