Hmmm, that's a good lesson for me because I was trying to be as clear as
possible about my problem and thought I had succeeded
...Maybe it's
time I improve my communication skills. Anyway, the reason I was
reluctant to post my XML and XSL is because when I did that before,
nobody answered so I thought: "Maybe it scares people...So if I want
answers I will have to ask small questions and not provide too much code
at once." Here's my XML anyway:
<?xml version="1.0" encoding="utf-8" ?>
<general>
<data>
<header></header>
<global>
<orderby />
<created />
</global>
<cols>
<fclient caption="Client" type="number" visible="True" />
<fid caption="Sleutelveld" type="number" visible="True" />
<fusername caption="Username" type="number" visible="True"/>
<fname caption="Naam" type="text" visible="True" />
<fcity caption="Woonplaats" type="text" visible="True" />
<factive caption="Active" type="text" visible="False" />
<fdebno caption="Debiteurnr" type="number" visible="True" />
<fpassword caption="password" type="text" visible="False" />
</cols>
<rows>
<row>
<id value="32" />
<fvalues>
<fclient>1</fclient>
<fid>13</fid>
<fusername>Pietje</fusername>
<fname>Pieters Autotransport B.V.</fname>
<fcity>Meppel</fcity>
<factive>True</factive>
<fdebno>5</fdebno>
<flanguage>NL</flanguage>
<fpassword>Flup</fpassword>
</fvalues>
</row>
<row>
<id value="43" />
<fvalues>
<fclient>2</fclient>
<fid>43</fid>
<fusername>Willie</fusername>
<fname>Willie Bruining</fname>
<fcity>Blijham</fcity>
<factive>True</factive>
<fdebno>9</fdebno>
<flanguage>NL</flanguage>
<fpassword>Kwik</fpassword>
</fvalues>
</row>
<row>
<id value="21" />
<fvalues>
<fclient>3</fclient>
<fid>83</fid>
<fusername>Bertje</fusername>
<fname>Bertje Autotransport B.V.</fname>
<fcity>Meppel</fcity>
<factive>True</factive>
<fdebno>9</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>3</fdebno>
<flanguage>NL</flanguage>
<fpassword>Kwak</fpassword>
</fvalues>
</row>
<row>
<id value="25" />
<fvalues>
<fclient>5</fclient>
<fid>23</fid>
<fusername>Pietje</fusername>
<fname>Bob Autotransport B.V.</fname>
<fcity>Zaandam</fcity>
<factive>True</factive>
<fdebno>9</fdebno>
<flanguage>NL</flanguage>
<fpassword>Kwuk</fpassword>
</fvalues>
</row>
<row>
<id value="68" />
<fvalues>
<fclient>4</fclient>
<fid>10</fid>
<fusername>Sjoerd</fusername>
<fname>Sjoerd de Vries</fname>
<fcity>Billieham</fcity>
<factive>True</factive>
<fdebno>5</fdebno>
<flanguage>NL</flanguage>
<fpassword>Kwok</fpassword>
</fvalues>
</row>
</rows>
</data>
<footer></footer>
</general>
And here's the XSL (based on an example by RDC Pro):
<?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
utput method="html" encoding="UTF-8"/>
<xsl
aram name="username" select="general/data/rows/row"/>
<xsl
aram name="field1" select="'fclient'"/>
<xsl
aram name="filter1" select="$username/fvalues/fclient"/>
<xsl
aram name="field2" select="'fcity'"/>
<xsl
aram name="filter2" select="$username/fvalues/fcity"/>
<xsl
aram name="direction">ascending</xsl
aram>
<xsl
aram name="sortBy">fusername</xsl
aram>
<xsl:variable name="tableData">
<xsl:apply-templates
select="general/data/rows/row/fvalues[name()=$field1 and
node()=$filter1][name()=$field2 and node()=$filter2] " 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)/fvalues">
<xsl:sort select="*[name()=$sortBy]" order="{$direction}"/>
</xsl:apply-templates>
</table>
</div>
</xsl:template>
<xsl:template match="fvalues">
<tr>
<xsl:for-each select="*">
<td>
<xsl:value-of select="."/>
</td>
</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>
Now I want the data to display properly, just like it does with the
select statement of the apply-templates in the variable that I mentioned
in my last post. I filled in what I thought you meant in my XSL but it
still won't show any data, maybe you meant something else. Anyway thanks
a lot for your comments, hope you can help me some more with this
example code. Thanks! Sharon