XSL stylesheet: why do data appear outside table?

Discussion in 'XML' started by Sharon, May 17, 2004.

  1. Sharon

    Sharon Guest

    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>
     
    Sharon, May 17, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=

    Stylesheet referanse i stylesheet

    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=, Jul 3, 2004, in forum: XML
    Replies:
    3
    Views:
    608
    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=
    Jul 4, 2004
  2. Thomas Sommer
    Replies:
    0
    Views:
    444
    Thomas Sommer
    Nov 25, 2004
  3. MC
    Replies:
    1
    Views:
    7,345
    David Carlisle
    Mar 24, 2005
  4. Replies:
    0
    Views:
    558
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,216
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page