Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSL stylesheet: why do data appear outside table?

Reply
Thread Tools

XSL stylesheet: why do data appear outside table?

 
 
Sharon
Guest
Posts: n/a
 
      05-17-2004
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"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-comslt"
xmlns:dates="urn:rdcpro-com:dates"
>

<xslutput method="xml" encoding="UTF-8"/>
<xslaram name="username" select="general/data/rows/row"/>
<xslaram name="city" select="$username/fvalues/fcity"/>
<xslaram name="debiteurnr" select="$username/fvalues/fdebno"/>
<xslaram name="direction">ascending</xslaram>
<xslaram name="sortBy">fusername</xslaram>
<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>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with pix inside->outside + dmz->outside + inside->outside->dmz Jack Cisco 0 09-19-2007 01:57 AM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
CDO.Send - does not appear to work sending to outside domains. Owen ASP General 5 02-23-2004 01:21 AM
Make panel appear outside browser window? Simon Storr ASP .Net 7 02-10-2004 12:27 AM



Advertisments