Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: help wanted

From: "news.microsoft.com" <djo267 at hotmail dot com>
To: NULL
Date: 12/3/2006 2:10:00 AM

Maybe I am confused with what the exact issue is, but why not just use the 
following?
dan

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0">

    <xsl:template match="/"><xsl:apply-templates/></xsl:template>

    <xsl:template match="restaurant">
        <span class="">
            <b>Name: </b>
            <xsl:value-of select="name" />
            <br />
            <b>Description: </b>
            <xsl:value-of select="description" />
            <br />
            <b>Location: </b>
            <xsl:value-of select="suburb" />
            <br />
            <b>Phone: </b>
            <xsl:value-of select="phone" />
            <br />
            <b>Email: </b>
            <a HREF="mailto:{email}">
                <xsl:value-of select="email" />
            </a>
            <br />
            <br />
        </span>
    </xsl:template>
</xsl:stylesheet>


<djcamo@i...> wrote in message 
news:1164086635.757822.62480@m......
> Hello,
>
> I have spent the better part of a week trying to figure out how to
> dynamically filter data based upon text retrieved from a text box on a
> web page. I am now at the stage where the filtering is working ok but I
> get duplicate results. If I have 2 entries in the XML file I get the
> results 2 time, if I have 3 entries i get the results 3 times (as
> shown)etc. Can anyone tell me where I am going wrong. I have listed the
> xsl file the xml data and the resulting html below.
>
> Thanks in advance,
> Dave
>
> ---XSL---
> <xsl:param name="rest" select="restaurants/restaurant"/>
> <xsl:param name="name" select="$rest/name"/>
> <xsl:param name="cuisine" select="$rest/cuisine"/>
> <xsl:param name="area" select="$rest/area"/>
> <xsl:variable name="tableData">
> <xsl:apply-templates select="$rest[area=$area and cuisine=$cuisine]"
> mode="tableData" />
> </xsl:variable>
>
> <xsl:template match="restaurants/restaurant">
> <xsl:apply-templates select="msxsl:node-set($tableData)/restaurant">
> </xsl:apply-templates>
> </xsl:template>
>
> <xsl:template match="restaurant">
>     <span class="">
>      <b>Name: </b>
>      <xsl:value-of select="name" />
>      <br />
>      <b>Description: </b>
>      <xsl:value-of select="description" />
>      <br />
>      <b>Location: </b>
>      <xsl:value-of select="suburb" />
>      <br />
>      <b>Phone: </b>
>        <xsl:value-of select="phone" />
>      <br />
>      <b>Email: </b>
>      <a HREF="mailto:{email}">
>        <xsl:value-of select="email" />
>      </a>
>      <br />
>      <br />
>    </span>
>  </xsl:template>
>  <xsl:template match="restaurant" mode="tableData">
> <xsl:copy>
> <xsl:copy-of select="name"/>
> <xsl:copy-of select="description"/>
> <xsl:copy-of select="suburb"/>
> <xsl:copy-of select="phone"/>
> <xsl:copy-of select="email"/>
> </xsl:copy>
>  </xsl:template>
>
> ---XML---
> <restaurants>
>    <restaurant>
>        <name>Dave's Place</name>
>        <cuisine>Italian</cuisine>
>        <area>South</area>
>        <description>Homely little restaurant.</description>
>        <address>29 Walpole St</address>
>        <suburb>Kew</suburb>
>        <phone>03 1111 2222</phone>
>        <email>qaz@w...</email>
>    </restaurant>
>    <restaurant>
>        <name>Thai Harder</name>
>        <cuisine>Asian</cuisine>
>        <area>East</area>
>       <description>Homely little restaurant.</description>
>        <address>400 High St</address>
>        <suburb>Carlton</suburb>
>        <phone>03 9629 4566</phone>
>        <email>Thai@H...</email>
>    </restaurant>
>    <restaurant>
>        <name>La Porchetta</name>
>        <cuisine>Italian</cuisine>
>        <area>East</area>
>        <description>Homely little restaurant.</description>
>        <address>Walpole St</address>
>        <suburb>Kew</suburb>
>        <phone>98530666</phone>
>        <email>qaz@w...</email>
>    </restaurant>
> </restaurants>
>
> ---HTML Results (only Italian restaurants)---
> Name: Dave's Place
> Description: Homely little restaurant.
> Location: Kew
> Phone: 03 1111 2222
> Email: wsx@e...
>
> Name: La Porchetta
> Description: Homely little restaurant.
> Location: Kew
> Phone: 98530666
> Email: qaz@w...
>
> Name: Dave's Place
> Description: Homely little restaurant.
> Location: Kew
> Phone: 03 1111 2222
> Email: wsx@e...
>
> Name: La Porchetta
> Description: Homely little restaurant.
> Location: Kew
> Phone: 98530666
> Email: qaz@w...
>
> Name: Dave's Place
> Description: Homely little restaurant.
> Location: Kew
> Phone: 03 1111 2222
> Email: wsx@e...
>
> Name: La Porchetta
> Description: Homely little restaurant.
> Location: Kew
> Phone: 98530666
> Email: qaz@w...
> 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent