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:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="ur n:schemas-microsoft-com:xslt"
xmlns:dates="ur n:rdcpro-com:dates"
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:param name="username" select="general/data/rows/row"/>
<xsl:param name="city" select="$userna me/fvalues/fcity"/>
<xsl:param name="debiteurn r" select="$userna me/fvalues/fdebno"/>
<xsl:param name="direction ">ascending </xsl:param>
<xsl:param name="sortBy">f username</xsl:param>
<xsl:variable name="tableData ">
<xsl:apply-templates
select="$userna me/fvalues[fcity=$city][fdebno=$debiteu rnr]"
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="$direct ion"/>
<br/>
Sort Column:
<xsl:value-of select="$sortBy "/>
</div>
<table border="1" class="results" align="center" cellpadding="5"
cellspacing="0" >
<tr>
<th>
<a class="clickanc hor" onclick="render Data('fclient') ;">
<xsl:value-of select="cols/fclient/@caption"/>
</a>
</th>
<th>
<a class="clickanc hor" onclick="render Data('fid');">
<xsl:value-of select="cols/fid/@caption"/>
</a>
</th>
<th>
<a class="clickanc hor" onclick="render Data('fusername ');">
<xsl:value-of select="cols/fusername/@caption"/>
</a>
</th>
<th>
<a class="clickanc hor" onclick="render Data('fname');" >
<xsl:value-of select="cols/fname/@caption"/>
</a>
</th>
<th>
<a class="clickanc hor" onclick="render Data('fcity');" >
<xsl:value-of select="cols/fcity/@caption"/>
</a>
</th>
<th>
<a class="clickanc hor" onclick="render Data('fdebno'); ">
<xsl:value-of select="cols/fdebno/@caption"/>
</a>
</th>
</tr>
<xsl:apply-templates select="msxsl:n ode-set($tableData) ">
<xsl:sort select="*[name()=$sortBy]" order="{$direct ion}"/>
</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(cur rent())]/@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(cur rent())]/@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="Sleute lveld" color="" width="40" type="number"
visible="True" />
<fusername caption="Userna me" color="" width="60" type="number"
visible="True" />
<fname caption="Naam" color="" width="120" type="text"
visible="True" />
<fcity caption="Woonpl aats" color="" width="100" type="text"
visible="True" />
<factive caption="Active " color="" width="60" type="text"
visible="False" />
<fdebno caption="debite urnr" color="" width="80" type="number"
visible="True" />
<fpassword caption="passwo rd" color="" width="10" type="text"
visible="False" />
</cols>
<rows>
<row>
<id value="32" />
<fvalues>
<fclient>0</fclient>
<fid>103</fid>
<fusername>Piet je</fusername>
<fname>Pieter s Autotransport B.V.</fname>
<fcity>Hoogevee n</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>will ie</fusername>
<fname>willie bruining</fname>
<fcity>blijha m</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>Bert je</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>Bill ie</fusername>
<fname>Billie bruining</fname>
<fcity>billieha m</fcity>
<factive>True </factive>
<fdebno>8</fdebno>
<flanguage>NL </flanguage>
<fpassword>Kwak </fpassword>
</fvalues>
</row>
</rows>
</data>
<footer></footer>
</general>